/** * Returns an array with the PlayJoom update informations * * @return array * * @since 0.9 */ public function getUpdateInformation() { $dispatcher = JDispatcher::getInstance(); // Initialise the return array $ret = array('installed' => PJVERSION, 'latest' => null, 'object' => null); // Fetch the update information from the database $db = $this->getDbo(); $query = $db->getQuery(true)->select('*')->from($db->qn('#__updates'))->where($db->qn('extension_id') . ' = ' . $db->q($this->UpdateConf->get('PJUpdate_extension_id'))); $db->setQuery($query); $updateObject = $db->loadObject(); if (is_null($updateObject)) { $ret['latest'] = PJVERSION; return $ret; } else { $ret['latest'] = $updateObject->version; } // Fetch the full udpate details from the update details URL $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Fetch the full udpate details from the update details URL: ' . $updateObject->detailsurl, 'priority' => JLog::INFO, 'section' => 'admin'))); $update = new PlayjoomupdateHelper(); $update->loadFromXML($updateObject->detailsurl); // Pass the update object if ($ret['latest'] == PJVERSION) { $ret['object'] = null; } else { $ret['object'] = $update; } return $ret; }