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
- $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
------
StatusNet 1.0.0beta3
27 August 2011
StatusNet 1.0.0beta4
16 September 2011
This is the README file for StatusNet, the Open Source social
networking platform. It includes installation instructions,

View File

@ -324,8 +324,12 @@ class Action extends HTMLOutputter // lawsuit
$this->script('xbImportNode.js');
$this->script('geometa.js');
}
$this->inlineScript('var _peopletagAC = "' .
common_local_url('peopletagautocomplete') . '";');
// 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 = "' .
common_local_url('peopletagautocomplete') . '";');
}
$this->showScriptMessages();
// Anti-framing code to avoid clickjacking attacks in older browsers.
// 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); }
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('LACONICA_VERSION', STATUSNET_VERSION); // compatibility

View File

@ -71,18 +71,25 @@ function mail_backend()
*/
function mail_send($recipients, $headers, $body)
{
// XXX: use Mail_Queue... maybe
$backend = mail_backend();
if (!isset($headers['Content-Type'])) {
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
}
assert($backend); // throws an error if it's bad
$sent = $backend->send($recipients, $headers, $body);
if (PEAR::isError($sent)) {
common_log(LOG_ERR, 'Email error: ' . $sent->getMessage());
try {
// XXX: use Mail_Queue... maybe
$backend = mail_backend();
if (!isset($headers['Content-Type'])) {
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
}
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 true;
}
/**

View File

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

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc.
*
* URL mapper
*
*
* PHP version 5
*
* 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
*
* 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.
*
* @category URL
@ -58,6 +58,7 @@ class URLMapper
protected $statics = array();
protected $variables = array();
protected $reverse = array();
protected $allpaths = 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));
}
$allpaths[] = $path;
$action = $args[self::ACTION];
$paramNames = $this->getParamNames($path);
@ -119,7 +122,7 @@ class URLMapper
return $results;
}
}
throw new Exception(sprintf('No match for path "%s"', $path));
}
@ -173,7 +176,7 @@ class URLMapper
$path = vsprintf($format, $toFormat);
}
if (!empty($qstring)) {
if (!empty($qstring)) {
$formatted = http_build_query($qstring);
$path .= '?' . $formatted;
}
@ -223,6 +226,11 @@ class URLMapper
return $format;
}
public function getPaths()
{
return $this->allpaths;
}
}
class PatternReplacer

View File

@ -551,4 +551,25 @@ class BookmarkPlugin extends MicroAppPlugin
// TRANS: Application title.
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()
{
updateSchemaCore();
updateSchemaPlugins();
if (Event::handle('StartUpgrade')) {
updateSchemaCore();
updateSchemaPlugins();
// These replace old "fixup_*" scripts
// These replace old "fixup_*" scripts
fixupNoticeRendered();
fixupNoticeConversation();
initConversation();
initInbox();
fixupGroupURI();
fixupNoticeRendered();
fixupNoticeConversation();
initConversation();
initInbox();
fixupGroupURI();
initLocalGroup();
initNoticeReshare();
initLocalGroup();
initNoticeReshare();
initFaveURI();
initSubscriptionURI();
initGroupMemberURI();
initFaveURI();
initSubscriptionURI();
initGroupMemberURI();
Event::handle('EndUpgrade');
}
}
function tableDefs()