const USERS_PER_MAP = 50000;
const NOTICES_PER_MAP = 50000;
- /**
- * Load related modules when needed
- *
- * @param string $cls Name of the class to be loaded
- *
- * @return boolean hook value; true means continue processing, false means stop.
- */
- function onAutoload($cls)
- {
- $dir = dirname(__FILE__);
-
- switch ($cls)
- {
- case 'Sitemap_user_count':
- case 'Sitemap_notice_count':
- require_once $dir . '/' . $cls . '.php';
- return false;
- case 'SitemapindexAction':
- case 'NoticesitemapAction':
- case 'UsersitemapAction':
- case 'SitemapadminpanelAction':
- require_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
- return false;
- case 'SitemapAction':
- require_once $dir . '/' . strtolower($cls) . '.php';
- return false;
- default:
- return true;
- }
- }
-
/**
* Add sitemap-related information at the end of robots.txt
*
/**
* Map URLs to actions
*
- * @param Net_URL_Mapper $m path-to-action mapper
+ * @param URLMapper $m path-to-action mapper
*
* @return boolean hook value; true means continue processing, false means stop.
*/
- function onRouterInitialized($m)
+ public function onRouterInitialized(URLMapper $m)
{
$m->connect('sitemapindex.xml',
array('action' => 'sitemapindex'));
- $m->connect('/notice-sitemap-:year-:month-:day-:index.xml',
+ $m->connect('notice-sitemap-:year-:month-:day-:index.xml',
array('action' => 'noticesitemap'),
array('year' => '[0-9]{4}',
'month' => '[01][0-9]',
'day' => '[0123][0-9]',
'index' => '[1-9][0-9]*'));
- $m->connect('/user-sitemap-:year-:month-:day-:index.xml',
+ $m->connect('user-sitemap-:year-:month-:day-:index.xml',
array('action' => 'usersitemap'),
array('year' => '[0-9]{4}',
'month' => '[01][0-9]',
'day' => '[0123][0-9]',
'index' => '[1-9][0-9]*'));
- $m->connect('admin/sitemap',
+ $m->connect('panel/sitemap',
array('action' => 'sitemapadminpanel'));
return true;
{
$schema = Schema::get();
- $schema->ensureTable('sitemap_user_count',
- array(new ColumnDef('registration_date', 'date', null,
- true, 'PRI'),
- new ColumnDef('user_count', 'integer'),
- new ColumnDef('created', 'datetime',
- null, false),
- new ColumnDef('modified', 'timestamp')));
-
- $schema->ensureTable('sitemap_notice_count',
- array(new ColumnDef('notice_date', 'date', null,
- true, 'PRI'),
- new ColumnDef('notice_count', 'integer'),
- new ColumnDef('created', 'datetime',
- null, false),
- new ColumnDef('modified', 'timestamp')));
-
- $userCreated = $schema->getColumnDef('user', 'created');
-
- if (empty($userCreated) || $userCreated->key != 'MUL') {
- $schema->createIndex('user', 'created');
- }
-
+ $schema->ensureTable('sitemap_user_count', Sitemap_user_count::schemaDef());
+ $schema->ensureTable('sitemap_notice_count', Sitemap_notice_count::schemaDef());
return true;
}
*
* @return boolean hook value
*/
- function onPluginVersion(&$versions)
+ function onPluginVersion(array &$versions)
{
$url = 'http://status.net/wiki/Plugin:Sitemap';
$versions[] = array('name' => 'Sitemap',
- 'version' => STATUSNET_VERSION,
+ 'version' => GNUSOCIAL_VERSION,
'author' => 'Evan Prodromou',
'homepage' => $url,
'rawdescription' =>