예제 #1
0
 /**
  * Tests that the timer method returns the expected result.
  *
  * @return void
  */
 public function testReportTimerReturnsMilliSeconds()
 {
     $start = microtime(true);
     $report = new Report();
     $report->start();
     usleep(50000);
     // 50 Milli Seconds
     $report->end();
     $time = ceil((microtime(true) - $start) * 1000.0);
     $this->assertGreaterThanOrEqual(50.0, $report->getElapsedTimeInMillis());
     $this->assertLessThanOrEqual($time, $report->getElapsedTimeInMillis());
 }
예제 #2
0
 public function report()
 {
     $errors = count($this->errors['sku']) + count($this->errors['name']);
     $success = count($this->products) - $errors;
     $tab = new Tabs();
     $report = new Report();
     $tab->start();
     $tab->start("buttons");
     $tab->button("info", false, true);
     $success > 0 ? $tab->button("success", $success) : $tab->button("success");
     $errors > 0 ? $tab->button("errors", $errors) : $tab->button("errors");
     $tab->end("buttons");
     $tab->start("entries");
     $tab->entry("info", true);
     $report->start("import data");
     $report->entry("info", "info", "Products to be added: " . count($this->products));
     $report->entry($errors > 0 ? "warning" : "success", $errors > 0 ? "warning" : "success", "Products added: {$success}");
     $report->entry($errors > 0 ? "warning" : "info", $errors > 0 ? "warning" : "info", "Errors: {$errors}");
     $report->entry("info", "info", "Clearing parsed data and import file");
     if (unlink($_SESSION['upload_file'])) {
         unset($_SESSION['upload_file']);
         unset($_SESSION['products']);
         $report->entry("success", "success", "Cleared parsed data");
     }
     if ($errors == 0) {
         $report->entry("success", "success", "Import completed without errors");
     } else {
         $report->entry("warning", "warning", "Import completed with errors please review");
     }
     $report->end();
     $tab->entry("end");
     $tab->entry("success");
     $report->start("Successful product creation");
     foreach ($this->products as $key => $product) {
         if (!in_array($product['sku'], $this->errors['sku']) && !in_array($product['name'], $this->errors['name'])) {
             $report->entry("success", "product: {$key}", "Added: " . $product['name']);
         }
     }
     if ($success == 0) {
         $report->entry("info", "info", "No products we're added");
     }
     $report->end();
     $tab->entry("end");
     $tab->entry("errors");
     if (count($this->errors['sku']) > 0) {
         $report->start("Sku duplicates");
         foreach ($this->products as $key => $product) {
             if (in_array($product['sku'], $this->errors['sku'])) {
                 $report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to duplicated sku: " . $product['sku'] . "<br/>Existing product: " . $this->duplicates[$product['sku']]);
             }
         }
         $report->end();
     }
     if (count($this->errors['name']) > 0) {
         $report->start("Name duplicates");
         foreach ($this->products as $key => $product) {
             if (in_array($product['name'], $this->errors['name'])) {
                 $report->entry("warning", "product: {$key}", "Failed to add product: " . $product['name'] . "<br />Due to not having a valid sku and provided name already exists<br/>Existing product: " . $product['sku']);
             }
         }
         $report->end();
     }
     if ($errors == 0) {
         $report->start("Import errors");
         $report->entry("info", "info", "No products have errors");
         $report->end();
     }
     $tab->entry("end");
     $tab->end("entries");
     $tab->end();
 }
예제 #3
0
 public function manage()
 {
     global $db;
     $blacklist = $db->select("blacklist");
     $report = new Report();
     $report->start("words & phrases", 3);
     if ($blacklist) {
         foreach ($blacklist as $phrase) {
             if (strpos($phrase['word'], " ") !== false) {
                 $format = "phrase";
             } else {
                 $format = "word";
             }
             $report->entry("default", $format, $phrase['word'] . "||<a class='btn btn-xs btn-danger' href='blacklist.php?d=" . $phrase['id'] . "' role='button'>delete</a>");
         }
     } else {
         $report->entry("danger", "error", "You seriously need to sit down and think about your life.");
     }
     $report->end();
 }
예제 #4
0
 public function check_flux()
 {
     $report = new Report();
     $report->start("flux files");
     $report->entry("info", "Flux Settings", "Off");
     $report->entry("info", "Flux Settings", "Checking for existing files");
     $files['Up'] = "../var/magmi-import/flux-up/Flux - {$this->collection_name}.csv";
     $files['Down'] = "../var/magmi-import/flux-down/Flux - {$this->collection_name}.csv";
     foreach ($files as $key => $file) {
         if (is_file($file)) {
             $report->entry("success", "{$key} File", "File exists, deleting file");
             unlink($file);
         } else {
             $report->entry("default", "{$key} File", "File does not exist, doing nothing");
         }
     }
     $report->end();
 }
예제 #5
0
파일: m2e.php 프로젝트: HQPDevCrew/BPU
        $result = $mage_db->select("m2epro_listing_product", $si['listing_product_id'], "product_id", 1);
        $si['product_id'] = $result['product_id'];
        if ($mp[$si['product_id']] !== $si['sku']) {
            if ($_SESSION['display']) {
                $entry = $mp[$si['product_id']] . "||" . $si['sku'];
                $report->entry("warning", $si['product_id'], $entry);
            } else {
                $mage_db->delete("m2epro_amazon_listing_product", "`listing_product_id` = " . $si['listing_product_id']);
                $mage_db->delete("m2epro_listing_product", $si['listing_product_id']);
                $html->redirection("../scripts.php");
            }
        }
        // else if($_SESSION['display']) {
        // 	$entry = $mp[$si['product_id']]."||".$si['sku'];
        // 	$report->entry("info", "skipping", $entry);
        // }
    }
    if ($_SESSION['display']) {
        $report->end();
    }
}
////////////////
// End Script //
////////////////
if ($_SESSION['display']) {
    echo '</div></div></div>';
}
$html->footer(false);
if ($alerts->trigger !== false) {
    $alerts->trigger();
}