Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
		@@ -148,7 +148,7 @@ class Fave extends Memcached_DataObject
 | 
			
		||||
        $act->title   = _("Favor");
 | 
			
		||||
        // TRANS: Ntofication given when a user marks a notice as favorite.
 | 
			
		||||
        // TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
 | 
			
		||||
        $act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
 | 
			
		||||
        $act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'),
 | 
			
		||||
                               $profile->getBestName(),
 | 
			
		||||
                               $notice->uri);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1117,7 +1117,7 @@ class Notice extends Memcached_DataObject
 | 
			
		||||
                    common_log_db_error($reply, 'INSERT', __FILE__);
 | 
			
		||||
                    // TRANS: Server exception thrown when a reply cannot be saved.
 | 
			
		||||
                    // TRANS: %1$d is a notice ID, %2$d is the ID of the mentioned user.
 | 
			
		||||
                    throw new ServerException(sprintf(_("Could not save reply for %1$d, %2$d."), $this->id, $mentioned->id));
 | 
			
		||||
                    throw new ServerException(sprintf(_('Could not save reply for %1$d, %2$d.'), $this->id, $mentioned->id));
 | 
			
		||||
                } else {
 | 
			
		||||
                    $replied[$mentioned->id] = 1;
 | 
			
		||||
                    self::blow('reply:stream:%d', $mentioned->id);
 | 
			
		||||
 
 | 
			
		||||
@@ -255,7 +255,7 @@ class Subscription extends Memcached_DataObject
 | 
			
		||||
        $act->title   = _("Follow");
 | 
			
		||||
        // TRANS: Notification given when one person starts following another.
 | 
			
		||||
        // TRANS: %1$s is the subscriber, %2$s is the subscribed.
 | 
			
		||||
        $act->content = sprintf(_("%1$s is now following %2$s."),
 | 
			
		||||
        $act->content = sprintf(_('%1$s is now following %2$s.'),
 | 
			
		||||
                               $subscriber->getBestName(),
 | 
			
		||||
                               $subscribed->getBestName());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -252,14 +252,14 @@ function mail_subscribe_notify_profile($listenee, $other)
 | 
			
		||||
 | 
			
		||||
        // TRANS: Main body of new-subscriber notification e-mail
 | 
			
		||||
        $body = sprintf(_('%1$s is now listening to your notices on %2$s.'."\n\n".
 | 
			
		||||
                          "\t".'%3$s'."\n\n".
 | 
			
		||||
                          "\t".'%3\$s'."\n\n".
 | 
			
		||||
                          '%4$s'.
 | 
			
		||||
                          '%5$s'.
 | 
			
		||||
                          '%6$s'.
 | 
			
		||||
                          "\n".'Faithfully yours,'."\n".'%7$s.'."\n\n".
 | 
			
		||||
                          "\n".'Faithfully yours,'."\n".'%7\$s.'."\n\n".
 | 
			
		||||
                          "----\n".
 | 
			
		||||
                          "Change your email address or ".
 | 
			
		||||
                          "notification options at ".'%8$s' ."\n"),
 | 
			
		||||
                          "notification options at ".'%8\$s' ."\n"),
 | 
			
		||||
                        $long_name,
 | 
			
		||||
                        common_config('site', 'name'),
 | 
			
		||||
                        $other->profileurl,
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ class UserNoProfileException extends ServerException
 | 
			
		||||
 | 
			
		||||
        // TRANS: Exception text shown when no profile can be found for a user.
 | 
			
		||||
        // TRANS: %1$s is a user nickname, $2$d is a user ID (number).
 | 
			
		||||
        $message = sprintf(_("User %1$s (%2$d) has no profile record."),
 | 
			
		||||
        $message = sprintf(_('User %1$s (%2$d) has no profile record.'),
 | 
			
		||||
                           $user->nickname, $user->id);
 | 
			
		||||
 | 
			
		||||
        parent::__construct($message);
 | 
			
		||||
 
 | 
			
		||||
@@ -150,7 +150,7 @@ class FacebookhomeAction extends FacebookAction
 | 
			
		||||
	    // over and over..
 | 
			
		||||
            // TRANS: Page title.
 | 
			
		||||
            // TRANS: %1$s is a user nickname, %2$s is a page number.
 | 
			
		||||
            return sprintf(_m("%1$s and friends, page %2$d"), $this->user->nickname, $this->page);
 | 
			
		||||
            return sprintf(_m('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
 | 
			
		||||
        } else {
 | 
			
		||||
            // TRANS: Page title.
 | 
			
		||||
            // TRANS: %s is a user nickname
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class AllmapAction extends MapAction
 | 
			
		||||
            // @todo CHECKME: does this even happen? May not be needed.
 | 
			
		||||
            // TRANS: Page title.
 | 
			
		||||
            // TRANS: %1$s is a user nickname, %2$d is a page number.
 | 
			
		||||
            return sprintf(_m("%1$s friends map, page %2$d"),
 | 
			
		||||
            return sprintf(_m('%1$s friends map, page %2$d'),
 | 
			
		||||
                           $base,
 | 
			
		||||
                           $this->page);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -655,7 +655,7 @@ class OStatusPlugin extends Plugin
 | 
			
		||||
            $act->title = _m("Join");
 | 
			
		||||
            // TRANS: Success message for subscribe to group attempt through OStatus.
 | 
			
		||||
            // TRANS: %1$s is the member name, %2$s is the subscribed group's name.
 | 
			
		||||
            $act->content = sprintf(_m("%1$s has joined group %2$s."),
 | 
			
		||||
            $act->content = sprintf(_m('%1$s has joined group %2$s.'),
 | 
			
		||||
                                    $member->getBestName(),
 | 
			
		||||
                                    $oprofile->getBestName());
 | 
			
		||||
 | 
			
		||||
@@ -707,7 +707,7 @@ class OStatusPlugin extends Plugin
 | 
			
		||||
            $act->title = _m("Leave");
 | 
			
		||||
            // TRANS: Success message for unsubscribe from group attempt through OStatus.
 | 
			
		||||
            // TRANS: %1$s is the member name, %2$s is the unsubscribed group's name.
 | 
			
		||||
            $act->content = sprintf(_m("%1$s has left group %2$s."),
 | 
			
		||||
            $act->content = sprintf(_m('%1$s has left group %2$s.'),
 | 
			
		||||
                                    $member->getBestName(),
 | 
			
		||||
                                    $oprofile->getBestName());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -81,6 +81,7 @@ class PushCallbackAction extends Action
 | 
			
		||||
        $challenge = $this->arg('hub_challenge');
 | 
			
		||||
        $lease_seconds = $this->arg('hub_lease_seconds');
 | 
			
		||||
        $verify_token = $this->arg('hub_verify_token');
 | 
			
		||||
        common_log(LOG_INFO, __METHOD__ . ": sub verification mode: $mode topic: $topic challenge: $challenge lease_seconds: $lease_seconds verify_token: $verify_token");
 | 
			
		||||
 | 
			
		||||
        if ($mode != 'subscribe' && $mode != 'unsubscribe') {
 | 
			
		||||
            // TRANS: Client exception. %s is an invalid value for hub.mode.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										102
									
								
								scripts/fixup_group_uri.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										102
									
								
								scripts/fixup_group_uri.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,102 @@
 | 
			
		||||
#!/usr/bin/env php
 | 
			
		||||
<?php
 | 
			
		||||
/*
 | 
			
		||||
 * StatusNet - a distributed open-source microblogging tool
 | 
			
		||||
 * Copyright (C) 2008, 2009, 2010 StatusNet, Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU Affero General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU Affero General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU Affero General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
 | 
			
		||||
 | 
			
		||||
$shortoptions = 'i:n:a';
 | 
			
		||||
$longoptions = array('id=', 'nickname=', 'all', 'dry-run');
 | 
			
		||||
 | 
			
		||||
$helptext = <<<END_OF_UPDATEAVATARURL_HELP
 | 
			
		||||
fixup_group_uri.php [options]
 | 
			
		||||
Fill in unstored URIs for groups in the system (added during 0.9)
 | 
			
		||||
 | 
			
		||||
  -i --id       ID of group to update
 | 
			
		||||
  -n --nickname nickname of the group to update
 | 
			
		||||
  -a --all      update all
 | 
			
		||||
     --dry-run  don't change anything
 | 
			
		||||
 | 
			
		||||
END_OF_UPDATEAVATARURL_HELP;
 | 
			
		||||
 | 
			
		||||
require_once INSTALLDIR.'/scripts/commandline.inc';
 | 
			
		||||
 | 
			
		||||
try {
 | 
			
		||||
    $user = null;
 | 
			
		||||
 | 
			
		||||
    if (have_option('i', 'id')) {
 | 
			
		||||
        $id = get_option_value('i', 'id');
 | 
			
		||||
        $group = User_group::staticGet('id', $id);
 | 
			
		||||
        if (empty($group)) {
 | 
			
		||||
            throw new Exception("Can't find group with id '$id'.");
 | 
			
		||||
        }
 | 
			
		||||
        updateGroupUri($group);
 | 
			
		||||
    } else if (have_option('n', 'nickname')) {
 | 
			
		||||
        $nickname = get_option_value('n', 'nickname');
 | 
			
		||||
        $group = User_group::staticGet('nickname', $nickname);
 | 
			
		||||
        if (empty($group)) {
 | 
			
		||||
            throw new Exception("Can't find group with nickname '$nickname'");
 | 
			
		||||
        }
 | 
			
		||||
        updateGroupUri($group);
 | 
			
		||||
    } else if (have_option('a', 'all')) {
 | 
			
		||||
        $group = new User_group();
 | 
			
		||||
        $group->whereAdd('uri IS NULL');
 | 
			
		||||
        if ($group->find()) {
 | 
			
		||||
            while ($group->fetch()) {
 | 
			
		||||
                updateGroupUri($group);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        show_help();
 | 
			
		||||
        exit(1);
 | 
			
		||||
    }
 | 
			
		||||
} catch (Exception $e) {
 | 
			
		||||
    print $e->getMessage()."\n";
 | 
			
		||||
    exit(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function updateGroupUri($group)
 | 
			
		||||
{
 | 
			
		||||
    if (!have_option('q', 'quiet')) {
 | 
			
		||||
        print "Updating URI for group '".$group->nickname."' (".$group->id.")...";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (empty($group->uri)) {
 | 
			
		||||
        // Using clone here was screwing up the group->find() iteration
 | 
			
		||||
        $orig = User_group::staticGet('id', $group->id);
 | 
			
		||||
 | 
			
		||||
        $group->uri = $group->getUri();
 | 
			
		||||
        if (have_option('dry_run')) {
 | 
			
		||||
            echo " would have set $group->uri ";
 | 
			
		||||
        } else {
 | 
			
		||||
            if (!$group->update($orig)) {
 | 
			
		||||
                throw new Exception("Can't update uri for group " . $group->nickname . ".");
 | 
			
		||||
            }
 | 
			
		||||
            echo " set $group->uri ";
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        print " already set, keeping $group->uri ";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (have_option('v', 'verbose')) {
 | 
			
		||||
        print "DONE.";
 | 
			
		||||
    }
 | 
			
		||||
    if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
 | 
			
		||||
        print "\n";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user