/**
  * Ritorna vero se la playlist ha una data di schedulazione inferiore alla
  * data attuale
  * 
  * @param int $parentNodeID
  * @return boolean
  */
 public static function checkPlaylistImportScheduled($parentNodeID)
 {
     $limit = 1000;
     $offset = 0;
     $imports = SQLIScheduledImport::fetchList($offset, $limit);
     foreach ($imports as $import) {
         if ($import instanceof SQLIScheduledImport) {
             $options = $import->getOptions();
             if ($options->hasAttribute('parentnodeid')) {
                 $_parentNodeID = $options->attribute('parentnodeid');
                 if ($parentNodeID == $_parentNodeID) {
                     // Legge la data della prossima shedulazione
                     $currentNextTime = $import->attribute('next');
                     $currentTime = time();
                     if ($currentNextTime < $currentTime) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             }
         }
     }
     return false;
 }
예제 #2
0
     $importFactory = SQLIImportFactory::instance();
     $importFactory->runImport($aImmediateImports);
     $importFactory->cleanup();
 }
 unset($aImmediateImports);
 // ##########
 // ##### End Immediate imports
 // ##########
 // ####################################################
 // ##########
 // ##### Scheduled imports
 // ##########
 // First fetch all scheduled imports to be processed
 $currentTimestamp = time();
 $conds = array('is_active' => 1, 'next' => array('<=', $currentTimestamp));
 $aScheduledImports = SQLIScheduledImport::fetchList(0, null, $conds);
 // Then create a pending SQLIImportItem for each scheduled import
 if (count($aScheduledImports) > 0) {
     $cli->output('Now handling scheduled imports');
     $aImportItems = array();
     foreach ($aScheduledImports as $scheduledImport) {
         // Create pending import
         $aImportItems[] = SQLIImportItem::fromScheduledImport($scheduledImport);
     }
     $importFactory = SQLIImportFactory::instance();
     $importFactory->setScheduledImports($aScheduledImports);
     $importFactory->runImport($aImportItems);
     $importFactory->cleanup();
     unset($aImportItems, $aScheduledImports);
 }
 // ##########
예제 #3
0
 * @copyright Copyright (C) 2010 - SQLi Agency. All rights reserved
 * @licence http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2
 * @author Jerome Vieilledent
 * @version @@@VERSION@@@
 * @package sqliimport
 */
$Module = $Params['Module'];
$Result = array();
$tpl = SQLIImportUtils::templateInit();
try {
    $offset = isset($Params['UserParameters']['offset']) ? (int) $Params['UserParameters']['offset'] : 0;
    // Offset for pagination
    $limit = eZPreferences::value('sqliimport_import_limit');
    $limit = $limit ? $limit : 10;
    // Default limit is 10
    $imports = SQLIScheduledImport::fetchList($offset, $limit);
    $importCount = SQLIScheduledImport::count(SQLIScheduledImport::definition());
    $currentURI = '/' . $Module->currentModule() . '/' . $Module->currentView();
    $tpl->setVariable('imports', $imports);
    $tpl->setVariable('offset', $offset);
    $tpl->setVariable('limit', $limit);
    $tpl->setVariable('uri', $currentURI);
    $tpl->setVariable('import_count', $importCount);
    $tpl->setVariable('view_parameters', $Params['UserParameters']);
} catch (Exception $e) {
    $errMsg = $e->getMessage();
    SQLIImportLogger::writeError($errMsg);
    $tpl->setVariable('error_message', $errMsg);
}
$Result['path'] = array(array('url' => false, 'text' => SQLIImportUtils::translate('extension/sqliimport', 'Scheduled import list')));
$Result['left_menu'] = 'design:sqliimport/parts/leftmenu.tpl';