/** * Add this type to $cond */ public static function select($cond = array()) { $cond['type'] = LG_VERSION; return parent::select($cond); }
<?php // Load the code common to standalone functionality include __DIR__ . '/standalone.php'; // These are the global objects made initially available to the app (only server objects are available if not logged in) $types = array(LG_SERVER, LG_LOG); if ($session) { $types[] = LG_USER; $types[] = LG_SESSION; } $objects = LigminchaGlobalObject::select(array('type' => $types)); $wgOut->addJsConfigVars('GlobalObjects', $objects); $wgOut->addJsConfigVars('toolbar', false); // Make the ID of the master server known to the client-side $wgOut->addJsConfigVars('masterServer', LigminchaGlobalServer::getMaster()->id); // Get the list of tags from the Github repo $config = JFactory::getConfig(); $auth = $config->get('lgRepoAuth'); $repoTags = array(); //json_decode( LigminchaGlobalDistributed::get( 'https://api.github.com/repos/Ligmincha/Code/tags', $auth ) ); $tags = array(); foreach ($repoTags as $tag) { if (preg_match('/^v([0-9.]+)/', $tag->name)) { $tags[$tag->name] = $tag->tarball_url; } } $wgOut->addJsConfigVars('tags', $tags); ?> <!DOCTYPE html> <html lang="en"> <head>
/** * Return the list of sync objects that will populate a newly created distributed database table */ private function initialTableData() { lgDebug('Table data requested'); // Just populate new tables with all the server, user and version objects $objects = LigminchaGlobalObject::select(array('type' => array(LG_SERVER, LG_USER, LG_VERSION))); // Ensure that the master server is first usort($objects, function ($a, $b) { if (property_exists($a, 'isMaster') && $a->isMaster) { return -1; } if (property_exists($b, 'isMaster') && $b->isMaster) { return 1; } return 0; }); // Create a normal update sync queue from these objects, but with no target so they won't be added to the database for sending $queue = array(0, LigminchaGlobalServer::getCurrent()->id, 0); foreach ($objects as $obj) { $queue[] = new LigminchaGlobalSync('U', $obj->fields(), false); } lgDebug('Table data returned (Objects: ' . count($objects) . ')'); return $queue; }