Merge branch 'testing' of gitorious.org:statusnet/mainline into testing

* 'testing' of gitorious.org:statusnet/mainline:
  disable routes that aren't available in single-user mode
  upgrade to beta4
  Better error handling when the email subsystem isn't working. The installer was dying trying to send a confirmation email to the initial user.
  Store a list of all paths the router knows about (backward compatibility with Net_URL_Mapper)
  Upgrade 0.9.x bookmarks to 1.0.x
  add hooks for upgrades
This commit is contained in:
Zach Copley 2011-09-17 13:06:12 -07:00
commit b83012878f
9 changed files with 92 additions and 40 deletions

View File

@ -1418,3 +1418,7 @@ StartShowInvitationSuccess: Right before showing invitations success msg
EndShowInvitationSuccess: After showing invitations success msg EndShowInvitationSuccess: After showing invitations success msg
- $action: invitation action - $action: invitation action
StartUpgrade: when starting a site upgrade
EndUpgrade: when ending a site upgrade; good place to do your own upgrades

4
README
View File

@ -2,8 +2,8 @@
README README
------ ------
StatusNet 1.0.0beta3 StatusNet 1.0.0beta4
27 August 2011 16 September 2011
This is the README file for StatusNet, the Open Source social This is the README file for StatusNet, the Open Source social
networking platform. It includes installation instructions, networking platform. It includes installation instructions,

View File

@ -324,8 +324,12 @@ class Action extends HTMLOutputter // lawsuit
$this->script('xbImportNode.js'); $this->script('xbImportNode.js');
$this->script('geometa.js'); $this->script('geometa.js');
} }
$this->inlineScript('var _peopletagAC = "' . // This route isn't available in single-user mode.
common_local_url('peopletagautocomplete') . '";'); // Not sure why, but it causes errors here.
if (!common_config('singleuser', 'enabled')) {
$this->inlineScript('var _peopletagAC = "' .
common_local_url('peopletagautocomplete') . '";');
}
$this->showScriptMessages(); $this->showScriptMessages();
// Anti-framing code to avoid clickjacking attacks in older browsers. // Anti-framing code to avoid clickjacking attacks in older browsers.
// This will show a blank page if the page is being framed, which is // This will show a blank page if the page is being framed, which is

View File

@ -20,7 +20,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
define('STATUSNET_BASE_VERSION', '1.0.0'); define('STATUSNET_BASE_VERSION', '1.0.0');
define('STATUSNET_LIFECYCLE', 'beta3'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' define('STATUSNET_LIFECYCLE', 'beta4'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('STATUSNET_VERSION', STATUSNET_BASE_VERSION . STATUSNET_LIFECYCLE); define('STATUSNET_VERSION', STATUSNET_BASE_VERSION . STATUSNET_LIFECYCLE);
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility

View File

@ -71,18 +71,25 @@ function mail_backend()
*/ */
function mail_send($recipients, $headers, $body) function mail_send($recipients, $headers, $body)
{ {
// XXX: use Mail_Queue... maybe try {
$backend = mail_backend(); // XXX: use Mail_Queue... maybe
if (!isset($headers['Content-Type'])) { $backend = mail_backend();
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
} if (!isset($headers['Content-Type'])) {
assert($backend); // throws an error if it's bad $headers['Content-Type'] = 'text/plain; charset=UTF-8';
$sent = $backend->send($recipients, $headers, $body); }
if (PEAR::isError($sent)) {
common_log(LOG_ERR, 'Email error: ' . $sent->getMessage()); assert($backend); // throws an error if it's bad
$sent = $backend->send($recipients, $headers, $body);
return true;
} catch (PEAR_Exception $e) {
common_log(
LOG_ERR,
"Unable to send email - '{$e->getMessage()}'. "
. 'Is your mail subsystem set up correctly?'
);
return false; return false;
} }
return true;
} }
/** /**

View File

@ -62,10 +62,12 @@ class PublicGroupNav extends Menu
$this->action->elementStart('ul', array('class' => 'nav')); $this->action->elementStart('ul', array('class' => 'nav'));
if (Event::handle('StartPublicGroupNav', array($this))) { if (Event::handle('StartPublicGroupNav', array($this))) {
// TRANS: Menu item in search group navigation panel. if (!common_config('singleuser', 'enabled')) {
$this->out->menuItem(common_local_url('public'), _m('MENU','Public'), // TRANS: Menu item in search group navigation panel.
// TRANS: Menu item title in search group navigation panel. $this->out->menuItem(common_local_url('public'), _m('MENU','Public'),
_('Public timeline'), $this->actionName == 'public', 'nav_timeline_public'); // TRANS: Menu item title in search group navigation panel.
_('Public timeline'), $this->actionName == 'public', 'nav_timeline_public');
}
// TRANS: Menu item in search group navigation panel. // TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('groups'), _m('MENU','Groups'), $this->out->menuItem(common_local_url('groups'), _m('MENU','Groups'),
@ -84,10 +86,12 @@ class PublicGroupNav extends Menu
_('Featured users'), $this->actionName == 'featured', 'nav_featured'); _('Featured users'), $this->actionName == 'featured', 'nav_featured');
} }
// TRANS: Menu item in search group navigation panel. if (!common_config('singleuser', 'enabled')) {
$this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'), // TRANS: Menu item in search group navigation panel.
// TRANS: Menu item title in search group navigation panel. $this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'),
_('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited'); // TRANS: Menu item title in search group navigation panel.
_('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited');
}
Event::handle('EndPublicGroupNav', array($this)); Event::handle('EndPublicGroupNav', array($this));
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* URL mapper * URL mapper
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
* Converts a path into a set of parameters, and vice versa * Converts a path into a set of parameters, and vice versa
* *
* We used to use Net_URL_Mapper, so there's a wrapper class at Router, q.v. * We used to use Net_URL_Mapper, so there's a wrapper class at Router, q.v.
* *
* NUM's vagaries are the main reason we have weirdnesses here. * NUM's vagaries are the main reason we have weirdnesses here.
* *
* @category URL * @category URL
@ -58,6 +58,7 @@ class URLMapper
protected $statics = array(); protected $statics = array();
protected $variables = array(); protected $variables = array();
protected $reverse = array(); protected $reverse = array();
protected $allpaths = array();
function connect($path, $args, $paramPatterns=array()) function connect($path, $args, $paramPatterns=array())
{ {
@ -65,6 +66,8 @@ class URLMapper
throw new Exception(sprintf("Can't connect %s; path has no action.", $path)); throw new Exception(sprintf("Can't connect %s; path has no action.", $path));
} }
$allpaths[] = $path;
$action = $args[self::ACTION]; $action = $args[self::ACTION];
$paramNames = $this->getParamNames($path); $paramNames = $this->getParamNames($path);
@ -119,7 +122,7 @@ class URLMapper
return $results; return $results;
} }
} }
throw new Exception(sprintf('No match for path "%s"', $path)); throw new Exception(sprintf('No match for path "%s"', $path));
} }
@ -173,7 +176,7 @@ class URLMapper
$path = vsprintf($format, $toFormat); $path = vsprintf($format, $toFormat);
} }
if (!empty($qstring)) { if (!empty($qstring)) {
$formatted = http_build_query($qstring); $formatted = http_build_query($qstring);
$path .= '?' . $formatted; $path .= '?' . $formatted;
} }
@ -223,6 +226,11 @@ class URLMapper
return $format; return $format;
} }
public function getPaths()
{
return $this->allpaths;
}
} }
class PatternReplacer class PatternReplacer

View File

@ -551,4 +551,25 @@ class BookmarkPlugin extends MicroAppPlugin
// TRANS: Application title. // TRANS: Application title.
return _m('TITLE','Bookmark'); return _m('TITLE','Bookmark');
} }
function onEndUpgrade()
{
// Version 0.9.x of the plugin didn't stamp notices
// with verb and object-type (for obvious reasons). Update
// those notices here.
$notice = new Notice();
$notice->whereAdd('exists (select uri from bookmark where bookmark.uri = notice.uri)');
$notice->whereAdd('((object_type is null) or (object_type = "' .ActivityObject::NOTE.'"))');
$notice->find();
while ($notice->fetch()) {
$original = clone($notice);
$notice->verb = ActivityVerb::POST;
$notice->object_type = ActivityObject::BOOKMARK;
$notice->update($original);
}
}
} }

View File

@ -33,23 +33,27 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
function main() function main()
{ {
updateSchemaCore(); if (Event::handle('StartUpgrade')) {
updateSchemaPlugins(); updateSchemaCore();
updateSchemaPlugins();
// These replace old "fixup_*" scripts // These replace old "fixup_*" scripts
fixupNoticeRendered(); fixupNoticeRendered();
fixupNoticeConversation(); fixupNoticeConversation();
initConversation(); initConversation();
initInbox(); initInbox();
fixupGroupURI(); fixupGroupURI();
initLocalGroup(); initLocalGroup();
initNoticeReshare(); initNoticeReshare();
initFaveURI(); initFaveURI();
initSubscriptionURI(); initSubscriptionURI();
initGroupMemberURI(); initGroupMemberURI();
Event::handle('EndUpgrade');
}
} }
function tableDefs() function tableDefs()