ikinci temizlik tamamlandı
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
|
||||
<?php
|
||||
//document_revisions
|
||||
$table = "test_packages";
|
||||
$mainPath2 = "008_Test_Pack/001_TP Preperation_Documents";
|
||||
$mainPath = "008_Test_Pack/002_TP_(Scan)";
|
||||
$nullDownload = db($table);
|
||||
$nullDownload = $nullDownload->get();
|
||||
//dump($nullDownload->count());
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$say = 0;
|
||||
$k = 0;
|
||||
Log::debug("📄$table PDF Link to DB Start " . simdi());
|
||||
try {
|
||||
foreach($nullDownload AS $ne) {
|
||||
$data = "{$ne->test_package_number}";
|
||||
$data = str_replace("/", "*", $data);
|
||||
$data = str_replace(" ", "*", $data);
|
||||
|
||||
|
||||
if(trim($data) != "") {
|
||||
$path = "storage/documents/$mainPath/*$data*";
|
||||
$searchPDF = glob($path);
|
||||
|
||||
|
||||
$updateData = [];
|
||||
|
||||
$updateData['test_pack_download'] = null;
|
||||
|
||||
|
||||
|
||||
if(isset($searchPDF[0])) {
|
||||
$updateData['test_pack_download'] = $searchPDF[0];
|
||||
}
|
||||
|
||||
//dump($updateData);
|
||||
|
||||
db($table)
|
||||
->where("id", $ne->id)
|
||||
->update($updateData);
|
||||
|
||||
|
||||
db("test_pack_base_statuses")
|
||||
->where("test_package_no", $ne->test_package_number)
|
||||
->update($updateData);
|
||||
|
||||
$k++;
|
||||
|
||||
|
||||
|
||||
if($say == $commitSize) {
|
||||
DB::commit();
|
||||
DB::beginTransaction();
|
||||
$say = 0;
|
||||
|
||||
}
|
||||
|
||||
$say++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
DB::commit();
|
||||
Log::debug("$table update PDF link for $k rows");
|
||||
//dump("$table update PDF link for $k rows");
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
Log::error("not update PDF links " . $th->getMessage());
|
||||
////dump($th->getMessage());
|
||||
}
|
||||
|
||||
Log::debug("📄$table PDF Link to DB Finish " . simdi());
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user