forked from GNUsocial/gnu-social
Merge branch '0.9.x' into 1.0.x
This commit is contained in:
37
scripts/fixup_status_network.php
Normal file
37
scripts/fixup_status_network.php
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, 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__) . '/..'));
|
||||
|
||||
require_once INSTALLDIR.'/scripts/commandline.inc';
|
||||
|
||||
common_log(LOG_INFO, 'Beginning status_network conversion...');
|
||||
|
||||
$sn = new Status_network();
|
||||
$sn->find();
|
||||
while ($sn->fetch()) {
|
||||
try {
|
||||
$sn->setTags(explode('|', $sn->tags));
|
||||
} catch (Exception $e) {
|
||||
common_log(LOG_ERR, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
common_log(LOG_INFO, 'Completed status_network conversion...');
|
@@ -39,11 +39,10 @@ if (count($args) < 1) {
|
||||
}
|
||||
|
||||
$nickname = $args[0];
|
||||
|
||||
$sn = Status_network::memGet('nickname', $nickname);
|
||||
|
||||
if (empty($sn)) {
|
||||
print "No such site.\n";
|
||||
print "No such site ($nickname).\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -54,16 +53,13 @@ if (count($args) == 1) {
|
||||
exit(0);
|
||||
}
|
||||
$tag = $args[1];
|
||||
|
||||
$i = array_search($tag, $tags);
|
||||
|
||||
if ($i !== false) {
|
||||
if (have_option('d', 'delete')) { // Delete
|
||||
unset($tags[$i]);
|
||||
|
||||
$orig = clone($sn);
|
||||
$sn->tags = implode('|', $tags);
|
||||
$result = $sn->update($orig);
|
||||
$result = $sn->setTags($tags);
|
||||
if (!$result) {
|
||||
print "Couldn't update.\n";
|
||||
exit(-1);
|
||||
@@ -78,9 +74,7 @@ if ($i !== false) {
|
||||
exit(-1);
|
||||
} else {
|
||||
$tags[] = $tag;
|
||||
$orig = clone($sn);
|
||||
$sn->tags = implode('|', $tags);
|
||||
$result = $sn->update($orig);
|
||||
$result = $sn->setTags($tags);
|
||||
if (!$result) {
|
||||
print "Couldn't update.\n";
|
||||
exit(-1);
|
||||
|
@@ -44,8 +44,8 @@ mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
|
||||
|
||||
GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
|
||||
GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
|
||||
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created, tags)
|
||||
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now(), '$tags');
|
||||
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created)
|
||||
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
|
||||
|
||||
ENDOFCOMMANDS
|
||||
|
||||
@@ -56,6 +56,8 @@ done
|
||||
|
||||
php $PHPBASE/scripts/checkschema.php -s"$server"
|
||||
|
||||
php $PHPBASE/scripts/settag.php -s"$server" "$nickname" "$tags"
|
||||
|
||||
php $PHPBASE/scripts/registeruser.php \
|
||||
-s"$server" \
|
||||
-n"$nickname" \
|
||||
|
Reference in New Issue
Block a user