/**
  * Returns the date and time when the last update check was made.
  * @return JDate
  */
 function _lastUpdateCheck()
 {
     jimport('joomla.utilities.date');
     $date = new JDate('2009-01-01');
     jpimport('core.utility.tables');
     if (JoomlapackCUBETables::CountVar('lastupdatecheck') < 1) {
         return $date;
     } else {
         return JoomlapackCUBETables::UnserializeVar('lastupdatecheck', $date);
     }
 }
Exemple #2
0
 function deleteTempFiles()
 {
     $configuration =& JoomlapackModelRegistry::getInstance();
     $tempFiles = JoomlapackCUBETables::UnserializeVar('CUBETempFiles', array());
     foreach ($tempFiles as $fileName) {
         $file = $configuration->getTemporaryDirectory() . DS . $fileName;
         if (file_exists($file)) {
             @unlink($file);
         }
     }
     JoomlapackCUBETables::DeleteVar('CUBETempFiles');
 }
 /**
  * Adds an entry to the engine includes table
  *
  * @param string $dottedNotation Dotted notation of class file to add to the list
  */
 function _addEngineInclude($dottedNotation)
 {
     if (JoomlapackCUBETables::CountVar('CUBEEngineIncludes') >= 1) {
         // There is a db entry. Load, and unserialize
         $includes = JoomlapackCUBETables::UnserializeVar('CUBEEngineIncludes');
     } else {
         // Start a new array
         $includes = array();
     }
     // Append to the array
     $includes[] = $dottedNotation;
     // Serialize and save
     JoomlapackCUBETables::SerializeVar('CUBEEngineIncludes', $includes);
 }
Exemple #4
0
 /**
  * Singleton pattern. It tries to load the CUBE off the database if it's not
  * found in memory. If it fails too, it creates a new object.
  *
  * @return JoomlapackCUBE
  */
 function &getInstance()
 {
     static $instance;
     if (!is_object($instance)) {
         // Try loading from database
         if (JoomlapackCUBETables::CountVar('CUBEObject') == 1) {
             JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBE::getInstance - Loading from database");
             // Get the includes first!
             JoomlapackCUBEProvisioning::retrieveEngineIncludes();
             // Then load the object
             $instance = JoomlapackCUBETables::UnserializeVar('CUBEObject');
             if (!is_object($instance)) {
                 // Damn! We have some broken crap in the db. Gotta retry :(
                 JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBE::getInstance - Broken in database, creating new instance");
                 $instance = new JoomlapackCUBE();
             }
         } else {
             // No stored object, we are forced to create a fresh object or something really
             // odd is going on with MySQL!
             JoomlapackLogger::WriteLog(_JP_LOG_DEBUG, "JoomlapackCUBE::getInstance - Not found in database, creating new instance");
             $instance = new JoomlapackCUBE();
         }
     }
     return $instance;
 }