-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcronScheduleClean.php
More file actions
30 lines (24 loc) · 981 Bytes
/
cronScheduleClean.php
File metadata and controls
30 lines (24 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$appState = $this->_objectManager->get('Magento\Framework\App\State');
$appState->setAreaCode('adminhtml');
$resource = $this->_objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
$tableName = $resource->getTableName('cron_schedule');
$sql = "DELETE FROM " . $tableName . " WHERE created_at < DATE_SUB(NOW(), INTERVAL 1 DAY)";
try{
$result = $connection->query($sql);
}catch(Exception $ex){
print_r($ex);
}
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);