- Автор темы
- #1
Помогите, пожалуйста. Не могу понять, почему не работает скрипт. Вроде все правильно написал а ничего не происходит. Сам скрипт должен удалять статьи дата публикации которых окончена. В базе данных WHERE publish_down <= NOW() AND publish_down != '0000-00-00 00:00:00' работает и показывает нужные. Но почему-то не удаляет. Ставил задачу на крон хостинга. Ошибок не видает но и не удаляет( Сайт на Joomla 
	
	
	
		
	
		
			
		
		
	
				
			
		PHP:
	
	<?php
const _JEXEC = 1;
// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
    require_once dirname(__DIR__) . '/defines.php';
}
if (!defined('_JDEFINES'))
{
    define('JPATH_BASE', dirname(__DIR__));
    require_once JPATH_BASE . '/includes/defines.php';
}
// Get the framework.
require_once JPATH_LIBRARIES . '/import.legacy.php';
// Bootstrap the CMS libraries.
require_once JPATH_LIBRARIES . '/cms.php';
// Configure error reporting to maximum for CLI output.
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Load Library language
$lang = JFactory::getLanguage();
// Try the files_joomla file in the current language (without allowing the loading of the file in the default language)
$lang->load('files_joomla.sys', JPATH_SITE, null, false, false)
// Fallback to the files_joomla file in the default language
|| $lang->load('files_joomla.sys', JPATH_SITE, null, true);
class DeletefilesCli extends JApplicationCli
{
    public function doExecute()
    {
        // Import the dependencies
        jimport('joomla.filesystem.file');
        jimport('joomla.filesystem.folder');
        // We need the update script
        JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');
        // Instantiate the class
        $class = new JoomlaInstallerScript;
        // Run the delete method
        $class->deleteUnexistingFiles();
    }
}
JApplicationCli::getInstance('DeletefilesCli')->execute();
        $db = JFactory::getDBO();
        $query = $db->getQuery(true);
        $query = "DELETE FROM  k7c1b_k2_items WHERE publish_down <= NOW() AND publish_down != '0000-00-00 00:00:00'";
        $db->setQuery($query);
        $result = $db->execute();
?> 
				