function process()
 {
     $path = (array) @$this->taskInstance()->settings;
     $path = $path['path'];
     $store = $this->dataStore();
     Log::info(sprintf('Value of (%s) in current data store.', $path), array('path' => $path, 'value' => util::deepVal($path, $store)));
 }
Exemple #2
0
 /**
  * Logout function, application terminating point.
  */
 static function invalidate($sid = null)
 {
     if ($sid === null) {
         $sid = static::$currentSession['sid'];
     }
     $sid = util::packUuid($sid);
     $session = Node::getOne(array(Node::FIELD_COLLECTION => FRAMEWORK_COLLECTION_SESSION, 'sid' => $sid));
     Database::query('DELETE FROM `' . FRAMEWORK_COLLECTION_SESSION . '` WHERE `sid` = ?', array($sid));
     Log::info(sprintf('Session invalidated', $session));
     /* Clear reference */
     static::$currentSession = null;
 }
Exemple #3
0
 /**
  * @protected
  *
  * Takes care of tasks and settings.
  */
 function beforeSave(array &$errors = array())
 {
     // packUuid
     if ($this->isCreate()) {
         // note; loop until we find a unique uuid
         do {
             $this->identity(Database::fetchField("SELECT UNHEX(REPLACE(UUID(), '-', ''))"));
         } while ($this->find(array($this->primaryKey() => $this->identity())));
     } else {
         if (isset($this->uuid)) {
             $this->uuid = util::packUuid($this->uuid);
         }
     }
     parent::beforeSave($errors);
     if (!$errors) {
         if (empty($this->tasks)) {
             unset($this->tasks);
         } else {
             // Only take task identity and settings
             $this->tasks = array_reduce($this->tasks, function ($result, $task) {
                 $taskModel = new Task($task);
                 $taskModel->load($taskModel->identity());
                 if ($taskModel->identity()) {
                     $result[] = array_filter(array('name' => $taskModel->name, 'version' => $taskModel->version, 'settings' => @$task['settings']));
                 }
                 return $result;
             }, array());
             \core\Log::info('Tasks', $this->tasks);
         }
     }
     return $this;
 }