本文整理汇总了PHP中Operation::deleteOldOperations方法的典型用法代码示例。如果您正苦于以下问题:PHP Operation::deleteOldOperations方法的具体用法?PHP Operation::deleteOldOperations怎么用?PHP Operation::deleteOldOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::deleteOldOperations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteOldOperations
public function testDeleteOldOperations()
{
// Create 10 operations
$i = 0;
for ($i = 0; $i < 10; $i++) {
$op = new Operation();
$op->status = Operation::STATUS_SUCCEEDED;
$op->timestamp = time();
$op->srcid = $i;
$op->cmdid = '1234.' . $i;
$op->optype = Operation::OPTYPE_IMPORTPDB;
$op->operand1 = "C:\\Program Files\\Apache Software Foundations\\htdocs\\crashfix\\protected\\data\\debugInfo\\CrashRpt{$i}.pdb";
$op->operand2 = "C:\\Program Files\\Apache Software Foundations\\htdocs\\crashfix\\protected\runtime\tmp1234{$i}.tmp";
$this->assertTrue($op->save());
}
// Delete old operations
Operation::deleteOldOperations(5);
// Expect there are 5 ops now
$count = Operation::model()->count();
$this->assertTrue($count == 5);
}
示例2: run
public function run($args)
{
Yii::log("Entering the method run", "info");
if (0 != $this->checkDaemonStatus()) {
return 1;
}
// Delete old operations
Operation::deleteOldOperations();
// Look for started debug info deletion operations,check their statuses
// and finalize completed operations.
$this->checkDebugInfoDeletionOperations();
// Delete debug info files marked for deletion
$this->deletePendingDebugInfoFiles();
// Look for started debug info import operations, check their statuses
// and finalize completed operations.
$this->checkDebugInfoProcessingOperations();
// Import new debug info files uploaded recently.
$this->processNewDebugInfoFiles();
// Look for started crash report processing operations, check their statuses
// and finalize completed operations.
$this->checkCrashReportProcessingOperations();
// Process new crash report files uploaded recently.
$this->processNewCrashReportFiles();
// Send pending mail messages.
MailQueue::sendMail();
// Perform batch import of crash report files and PDB files
$importDir = Yii::app()->getBasePath() . "/import";
$batchImporter = new BatchImporter();
$importedCrashReportCount = 0;
$importedDebugInfoCount = 0;
$batchImporter->importFiles($importDir, $importedCrashReportCount, $importedDebugInfoCount);
// Delete old temp files
$this->deleteOldTempFiles();
// Success
Yii::log("Leaving the method run", "info");
return 0;
}