Beispiel #1
0
        continue;
    }
    $class = new $className();
    $cronInfo[$command] = $class->getCronInfo();
    unset($class);
}
if (file_exists("{$base}/cron.overrides")) {
    $overrides = file_get_contents("{$base}/cron.overrides");
    $overrides = json_decode($overrides, true);
    foreach ($overrides as $command => $info) {
        $cronInfo[$command] = $info;
    }
}
foreach ($cronInfo as $command => $info) {
    foreach ($info as $interval => $arguments) {
        runCron($command, $interval, $arguments);
    }
}
function runCron($command, $interval, $args)
{
    global $base;
    $curTime = time();
    if (is_array($args)) {
        array_unshift($args, $command);
    } else {
        if ($args != "") {
            $args = explode(" ", "{$command} {$args}");
        } else {
            $args = array($command);
        }
    }
        $file_data = json2Array($check);
        foreach ($file_data['vertexFramework'] as $key => $data) {
            $db = JFactory::getDBO();
            $query = "SELECT * FROM #__template_styles WHERE title = '{$key}';";
            $db->setQuery($query);
            $result = $db->loadAssocList();
            foreach ($result as $k => $style) {
                if (isset($style['title'])) {
                    $jsonData['vertexFramework'][$key] = $data;
                } else {
                    $cronned++;
                }
            }
        }
        $data = array2Json($jsonData);
        $file = fopen($file, 'w');
        fwrite($file, $data);
        fclose($file);
    }
    $msg = array('cron' => false);
    if ($cronned) {
        $msg = array('cron' => "{$cronned} items have been cleaned up");
    }
    return $msg;
}
ob_clean();
ob_start();
$cron = runCron();
$save = handleSaveFile($post['vertex'], $post['style_name'], isset($post['clear']) ? $post['clear'] : false);
$msg = array_merge($cron, $save);
print array2Json($msg);
Beispiel #3
0
    if (file_exists($file)) {
        $check = file_get_contents($file);
        $file_data = json2Array($check);
        foreach ($file_data['vertexFramework'] as $key => $data) {
            $db = JFactory::getDBO();
            $query = "SELECT * FROM #__template_styles WHERE title = '{$key}';";
            $db->setQuery($query);
            $result = $db->loadAssocList();
            foreach ($result as $k => $style) {
                if (isset($style['title'])) {
                    $jsonData['vertexFramework'][$key] = $data;
                } else {
                    unset($file_data['vertexFramework'][$key]);
                    $cronned++;
                }
            }
        }
        $data = array2Json($jsonData);
        $file = fopen($file, 'w');
        fwrite($file, $data);
        fclose($file);
    }
    $msg = array('message' => false);
    if ($cronned) {
        $msg = array('message' => "{$cronned} items have been cleaned up");
    }
    return array2Json($msg);
}
header('Content-type: application/json');
print runCron();