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 route isn't available in single-user mode.
// Not sure why, but it causes errors here.
if (!common_config('singleuser', 'enabled')) {
$this->inlineScript('var _peopletagAC = "' . $this->inlineScript('var _peopletagAC = "' .
common_local_url('peopletagautocomplete') . '";'); 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)
{ {
try {
// XXX: use Mail_Queue... maybe // XXX: use Mail_Queue... maybe
$backend = mail_backend(); $backend = mail_backend();
if (!isset($headers['Content-Type'])) { if (!isset($headers['Content-Type'])) {
$headers['Content-Type'] = 'text/plain; charset=UTF-8'; $headers['Content-Type'] = 'text/plain; charset=UTF-8';
} }
assert($backend); // throws an error if it's bad assert($backend); // throws an error if it's bad
$sent = $backend->send($recipients, $headers, $body); $sent = $backend->send($recipients, $headers, $body);
if (PEAR::isError($sent)) { return true;
common_log(LOG_ERR, 'Email error: ' . $sent->getMessage()); } 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))) {
if (!common_config('singleuser', 'enabled')) {
// TRANS: Menu item in search group navigation panel. // TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('public'), _m('MENU','Public'), $this->out->menuItem(common_local_url('public'), _m('MENU','Public'),
// TRANS: Menu item title in search group navigation panel. // TRANS: Menu item title in search group navigation panel.
_('Public timeline'), $this->actionName == 'public', 'nav_timeline_public'); _('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');
} }
if (!common_config('singleuser', 'enabled')) {
// TRANS: Menu item in search group navigation panel. // TRANS: Menu item in search group navigation panel.
$this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'), $this->out->menuItem(common_local_url('favorited'), _m('MENU','Popular'),
// TRANS: Menu item title in search group navigation panel. // TRANS: Menu item title in search group navigation panel.
_('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited'); _('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited');
}
Event::handle('EndPublicGroupNav', array($this)); Event::handle('EndPublicGroupNav', array($this));
} }

View File

@ -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);
@ -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,6 +33,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
function main() function main()
{ {
if (Event::handle('StartUpgrade')) {
updateSchemaCore(); updateSchemaCore();
updateSchemaPlugins(); updateSchemaPlugins();
@ -50,6 +51,9 @@ function main()
initFaveURI(); initFaveURI();
initSubscriptionURI(); initSubscriptionURI();
initGroupMemberURI(); initGroupMemberURI();
Event::handle('EndUpgrade');
}
} }
function tableDefs() function tableDefs()