PHRAS-3468 remove logs trace

This commit is contained in:
aynsix
2021-11-09 10:51:49 +03:00
parent 5b93a4b735
commit c12cefa028
13 changed files with 3 additions and 508 deletions

View File

@@ -1140,10 +1140,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
*/
public function set_metadatas(array $metadatas, $force_readonly = false)
{
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("into set_metadatas for record %s.%s", $this->getDataboxId(), $this->getRecordId())
), FILE_APPEND | LOCK_EX);
$databox_descriptionStructure = $this->getDatabox()->get_meta_structure();
foreach ($metadatas as $param) {
@@ -1168,16 +1164,8 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$this->write_metas();
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("dispatch event RecordEvents::METADATA_CHANGED for record %s.%s", $this->getDataboxId(), $this->getRecordId())
), FILE_APPEND | LOCK_EX);
$this->dispatch(RecordEvents::METADATA_CHANGED, new MetadataChangedEvent($this));
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("return from set_metadata for record %s.%s", $this->getDataboxId(), $this->getRecordId())
), FILE_APPEND | LOCK_EX);
return $this;
}
@@ -1682,10 +1670,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
*/
public static function createFromFile(File $file, Application $app)
{
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("into createFromFile")
), FILE_APPEND | LOCK_EX);
$collection = $file->getCollection();
$record = self::_create(
@@ -1703,28 +1687,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$newname_tmp = $newname.".tmp";
clearstatcache(true, $file->getFile()->getRealPath());
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("copying \"%s\" (size=%s) to \"%s\"", $file->getFile()->getRealPath(), filesize($file->getFile()->getRealPath()), $pathhd . $newname_tmp)
), FILE_APPEND | LOCK_EX);
$filesystem->copy($file->getFile()->getRealPath(), $pathhd . $newname_tmp);
clearstatcache(true, $pathhd . $newname_tmp);
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("copied \"%s\" to \"%s\" (size=%s)", $file->getFile()->getRealPath(), $pathhd . $newname_tmp, filesize($pathhd . $newname_tmp))
), FILE_APPEND | LOCK_EX);
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("moving \"%s\" (size=%s) to \"%s\"", $pathhd . $newname_tmp, filesize($pathhd . $newname_tmp), $pathhd . $newname)
), FILE_APPEND | LOCK_EX);
$filesystem->rename($pathhd . $newname_tmp, $pathhd . $newname);
clearstatcache(true, $pathhd . $newname);
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("moved \"%s\"to \"%s\" (size=%s) ", $pathhd . $newname_tmp, $pathhd . $newname, filesize($pathhd . $newname))
), FILE_APPEND | LOCK_EX);
$media = $app->getMediaFromUri($pathhd . $newname);
media_subdef::create($app, $record, 'document', $media);
@@ -1767,10 +1737,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
*/
private static function _create(collection $collection, Application $app, File $file=null)
{
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("into _create")
), FILE_APPEND | LOCK_EX);
$databox = $collection->get_databox();
$sql = "INSERT INTO record"
@@ -1793,10 +1759,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$record_id = $connection->lastInsertId();
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("sql record::inserted %s", $record_id)
), FILE_APPEND | LOCK_EX);
$record = new self($app, $databox->get_sbas_id(), $record_id);
try {
@@ -1813,12 +1775,6 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
':final' => $collection->get_coll_id(),
]);
$stmt->closeCursor();
file_put_contents(dirname(__FILE__).'/../../../logs/trace.txt', sprintf("%s [%s] : %s (%s); %s\n", (date('Y-m-d\TH:i:s')), getmypid(), __FILE__, __LINE__,
sprintf("sql log_docs::inserted add %s", $record_id)
), FILE_APPEND | LOCK_EX);
}
catch (\Exception $e) {
$record = null;