public function deleteExpiredRequests()
    {
        $helper = Mage::helper('sheep_debug');
        if (!$helper->isEnabled()) {
            return 'skipped: module is disabled.';
        }

        if ($helper->getPersistLifetime() == 0) {
            return 'skipped: lifetime is set to 0';
        }

        $expirationDate = $this->getExpirationDate(date(self::DATE_FORMAT));
        $table = $this->getRequestsTable();
        $deleteSql = "DELETE FROM {$table} WHERE date <= '{$expirationDate}'";

        /** @var Magento_Db_Adapter_Pdo_Mysql $connection */
        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');

        /** @var Varien_Db_Statement_Pdo_Mysql $result */
        $result = $connection->query($deleteSql);
        return "{$result->rowCount()} requests deleted";
    }
public function deleteExpiredRequests()
    {
        $helper = Mage::helper('sheep_debug');
        if (!$helper->isEnabled()) {
            return 'skipped: module is disabled.';
        }

        if ($helper->getPersistLifetime() == 0) {
            return 'skipped: lifetime is set to 0';
        }

        $expirationDate = $this->getExpirationDate(date(self::DATE_FORMAT));
        $table = $this->getRequestsTable();
        $deleteSql = "DELETE FROM {$table} WHERE date <= '{$expirationDate}'";

        /** @var Magento_Db_Adapter_Pdo_Mysql $connection */
        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');

        /** @var Varien_Db_Statement_Pdo_Mysql $result */
        $result = $connection->query($deleteSql);
        return "{$result->rowCount()} requests deleted";
    }
public function deleteExpiredRequests ( ) { $ helper = Mage :: helper ( 'sheep_debug' ) ; if ( ! $ helper -> isEnabled ( ) ) { return 'skipped: module is disabled.' ; } if ( $ helper -> getPersistLifetime ( ) == 0 ) { return 'skipped: lifetime is set to 0' ; } $ expirationDate = $ this -> getExpirationDate ( date ( self :: DATE_FORMAT ) ) ; $ table = $ this -> getRequestsTable ( ) ; $ deleteSql = "DELETE FROM {$table} WHERE date <= '{$expirationDate}'" ; /** @var Magento_Db_Adapter_Pdo_Mysql $connection */ $ connection = Mage :: getSingleton ( 'core/resource' ) -> getConnection ( 'core_write' ) ; /** @var Varien_Db_Statement_Pdo_Mysql $result */ $ result = $ connection -> query ( $ deleteSql ) ; return "{$result->rowCount()} requests deleted" ; }
Cron jobs that deletes expired request info
Cron jobs that deletes expired request info