[SCRIPTS] Set PUBLICDIR in plugin scripts as well

This commit is contained in:
Alexei Sorokin 2019-09-18 17:15:00 +03:00 committed by Diogo Peralta Cordeiro
parent 3460c13535
commit 1ba3416cd1
35 changed files with 743 additions and 596 deletions

View File

@ -25,7 +25,8 @@
* @link http://www.gnu.org/software/social/
*/
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u:af';
$longoptions = ['uri=', 'all', 'force'];

View File

@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
@ -19,7 +20,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:a';
$longoptions = array('id=', 'nickname=', 'all');

View File

@ -1,23 +1,30 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2012 StatusNet, Inc.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* Description of this file.
*
* 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/>.
* @package GNUsocial
* @copyright 2012 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:a';
$longoptions = array('id=', 'nickname=', 'all');
@ -31,15 +38,15 @@ Test user activities against the spam filter
-a --all All users
END_OF_TESTUSER_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
require_once INSTALLDIR . '/scripts/commandline.inc';
function testAllUsers($filter) {
function testAllUsers($filter)
{
$found = false;
$offset = 0;
$limit = 1000;
do {
$user = new User();
$user->orderBy('created');
$user->limit($offset, $limit);
@ -56,12 +63,11 @@ function testAllUsers($filter) {
}
$offset += $found;
}
} while ($found > 0);
}
function testUser($filter, $user) {
function testUser($filter, $user)
{
printfnq("Testing user %s\n", $user->nickname);
$profile = Profile::getKV('id', $user->id);

View File

@ -1,23 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2012 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2012 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:t:';
$longoptions = array('id=', 'nickname=', 'category=');
@ -34,8 +39,8 @@ END_OF_TRAINUSER_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
function trainUser($filter, $user, $category) {
function trainUser($filter, $user, $category)
{
printfnq("Training user %s\n", $user->nickname);
$profile = Profile::getKV('id', $user->id);

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<ENDOFHELP
USAGE: initialize_fave_tallys.php

View File

@ -1,34 +1,30 @@
#!/usr/bin/env php
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2010 StatusNet, Inc.
*
* Import a bookmarks file as notices
*
* PHP version 5
*
* 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/>.
*
* @category Bookmark
* @package StatusNet
* @package GNUsocial
* @author Evan Prodromou <evan@status.net>
* @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:f:';
$longoptions = array('id=', 'nickname=', 'file=');
@ -65,19 +61,19 @@ function getBookmarksFile()
if (!file_exists($filename)) {
// TRANS: Exception thrown when a file upload cannot be found.
// TRANS: %s is the file that could not be found.
throw new Exception(sprintf(_m('No such file "%s".'),$filename));
throw new Exception(sprintf(_m('No such file "%s".'), $filename));
}
if (!is_file($filename)) {
// TRANS: Exception thrown when a file upload is incorrect.
// TRANS: %s is the irregular file.
throw new Exception(sprintf(_m('Not a regular file: "%s".'),$filename));
throw new Exception(sprintf(_m('Not a regular file: "%s".'), $filename));
}
if (!is_readable($filename)) {
// TRANS: Exception thrown when a file upload is not readable.
// TRANS: %s is the file that could not be read.
throw new Exception(sprintf(_m('File "%s" not readable.'),$filename));
throw new Exception(sprintf(_m('File "%s" not readable.'), $filename));
}
// TRANS: %s is the filename that contains a backup for a user.
@ -95,7 +91,6 @@ try {
$qm = QueueManager::get();
$qm->enqueue(array($user, $html), 'dlcsback');
} catch (Exception $e) {
print $e->getMessage()."\n";
exit(1);

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Script to print out current version of the software
*
* 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
@ -46,7 +48,6 @@ if ($sendWelcome && have_option('t', 'template')) {
}
try {
$confirm = DomainStatusNetworkPlugin::registerEmail($email);
if ($sendWelcome) {
@ -56,7 +57,6 @@ try {
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
print $confirmUrl."\n";
} catch (Exception $e) {
print "ERROR: " . $e->getMessage() . "\n";
}

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Script to print out current version of the software
*
* 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain>

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* Script to print out current version of the software
*
* 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain>

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd';
$longoptions = array('dryrun');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, 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/>.
*/
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 't:e:auo';
$longoptions = array('type=', 'email=', 'all', 'universe', 'onetime');
@ -61,22 +65,24 @@ $opts = array(); // special options like "onetime"
if (have_option('t', 'type')) {
$type = trim(get_option_value('t', 'type'));
if (!in_array($type, array_keys($types)) && $type !== 'all') {
print _m("Unknown reminder type: {$type}.\n");
exit(1);
echo _m('Unknown reminder type: ' . $type . '.' . "\n");
exit(1);
}
} else {
show_help();
exit(1);
show_help();
exit(1);
}
if (have_option('o', 'onetime')) {
$opts['onetime'] = true;
if (!$quiet) { print "Special one-time reminder mode.\n"; }
if (!$quiet) {
echo 'Special one-time reminder mode.' . "\n";
}
}
$reminders = array();
switch($type) {
switch ($type) {
case 'register':
$reminders[] = $types['register'];
break;
@ -101,19 +107,27 @@ if (have_option('u', 'universe')) {
foreach ($reminders as $reminder) {
extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) { print "Sent pending {$type} reminders for {$server}.\n"; }
if (!$quiet) {
echo 'Sent pending ' . $type . ' reminders for ' . $server . '.' . "\n";
}
}
} catch (Exception $e) {
// keep going
common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__);
if (!$quiet) { print "Couldn't init {$server}.\n"; }
if (!$quiet) {
echo "Couldn't init " . $server . ".\n";
}
continue;
}
}
if (!$quiet) { print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; }
if (!$quiet) {
echo 'Done! Reminders sent to all unconfirmed addresses in the known universe.' . "\n";
}
}
} catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; }
if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1);
}
@ -133,20 +147,26 @@ if (have_option('u', 'universe')) {
throw new Exception("No confirmation code found for {$address}.");
}
$qm->enqueue(array($confirm, $opts), $utransport);
if (!$quiet) { print "Sent all pending {$type} reminder to {$address}.\n"; }
if (!$quiet) {
echo 'Sent all pending ' . $type . ' reminder to ' . $address . '.' . "\n";
}
}
} else if (have_option('a', 'all')) {
} elseif (have_option('a', 'all')) {
foreach ($reminders as $reminder) {
extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) { print "Sent pending {$type} reminders to all unconfirmed addresses on the site.\n"; }
if (!$quiet) {
echo 'Sent pending ' . $type . ' reminders to all unconfirmed addresses on the site.' . "\n";
}
}
} else {
show_help();
exit(1);
}
} catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; }
if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1);
}

View File

@ -1,23 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:au';
$longoptions = array('id=', 'nickname=', 'all', 'universe');

View File

@ -25,9 +25,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
defined('GNUSOCIAL');
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = ['dry-run', 'h-bug', 'broken-oembed', 'limit='];
@ -129,7 +128,6 @@ while ($fn->fetch()) {
echo " (ok, but embedding lookup failed)\n";
}
}
} elseif ($broken &&
(!$data instanceof File_embed ||
empty($data->title) ||
@ -165,7 +163,6 @@ while ($fn->fetch()) {
$thumb->decache();
}
}
}
if (isset($fetch) && $fetch === true && !$dry) {

View File

@ -25,9 +25,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
defined('GNUSOCIAL') || die();
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u:';
$longoptions = array('url=');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP
pollfeed.php feeduri

View File

@ -24,7 +24,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', dirname(dirname(dirname(__DIR__))));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
if (!defined('NODEINFO_UPGRADE')) {
$longoptions = ['type='];

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('dry-run');
@ -162,7 +166,7 @@ while ($oprofile->fetch()) {
$nick = '<deleted>';
}
echo "group $id ($nick) hidden by $uri";
} else if (preg_match('!/user/(\d+)!', $uri, $matches)) {
} elseif (preg_match('!/user/(\d+)!', $uri, $matches)) {
$id = intval($matches[1]);
$user = User::getKV('id', $id);
if ($user) {

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('delete-inactive');
$shortoptions = 'd';
@ -65,4 +69,6 @@ while ($feedsub->fetch()) {
}
}
if ($delete_inactive) echo "\nDeleted $delcount inactive feeds.\n";
if ($delete_inactive) {
echo "\nDeleted $delcount inactive feeds.\n";
}

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP
resub-feed.php

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('unsub');
$shortoptions = 'u';

View File

@ -24,8 +24,8 @@
* Run this from INSTALLDIR/plugins/OStatus/scripts
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd';
$longoptions = array('dry-run');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('skip=', 'count=');

View File

@ -20,7 +20,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('all', 'suspicious', 'quiet');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP
update-profile.php [options] http://example.com/profile/url
@ -64,7 +68,7 @@ try {
$feedurl = $discover->discoverFromURL($oprofile->uri);
$salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
?: $discover->getAtomLink(Salmon::NS_REPLIES); // NS_REPLIES is deprecated
if (empty($salmonuri) ) {
if (empty($salmonuri)) {
throw new FeedSubNoSalmonException('No salmon upstream URI was found');
}
} catch (FeedSubException $e) {

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 2011, 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u:af';
$longoptions = array('uri=', 'all', 'force');
@ -69,7 +73,7 @@ class LooseOstatusProfile extends Ostatus_profile
if (!$response->isOk()) {
// TRANS: Exception. %s is a profile URL.
throw new Exception(sprintf(_('Could not reach profile page %s.'),$profile_url));
throw new Exception(sprintf(_('Could not reach profile page %s.'), $profile_url));
}
// Check if we have a non-canonical URL
@ -120,7 +124,7 @@ class LooseOstatusProfile extends Ostatus_profile
}
// TRANS: Exception. %s is a URL.
throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl));
throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'), $finalUrl));
}
/**
@ -200,25 +204,25 @@ class LooseOstatusProfile extends Ostatus_profile
// will obscure the correct page-keyed profile later on.
}
}
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'),$addr));
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'), $addr));
}
}
function pullOstatusProfile($uri) {
function pullOstatusProfile($uri)
{
$oprofile = null;
$validate = new Validate();
if ($validate->email($uri)) {
$oprofile = LooseOstatusProfile::updateWebfinger($uri);
} else if ($validate->uri($uri)) {
} elseif ($validate->uri($uri)) {
$oprofile = LooseOstatusProfile::updateProfileURL($uri);
} else {
print "Sorry, we could not reach the address: $uri\n";
return false;
}
return $oprofile;
return $oprofile;
}
$quiet = have_option('q', 'quiet');
@ -227,7 +231,7 @@ $lop = new LooseOstatusProfile();
if (have_option('u', 'uri')) {
$lop->uri = get_option_value('u', 'uri');
} else if (!have_option('a', 'all')) {
} elseif (!have_option('a', 'all')) {
show_help();
exit(1);
}
@ -237,18 +241,26 @@ $forceUpdates = have_option('f', 'force');
$cnt = $lop->find();
if (!empty($cnt)) {
if (!$quiet) { echo "Found {$cnt} OStatus profiles:\n"; }
if (!$quiet) {
echo 'Found ' . $cnt . ' OStatus profiles:' . "\n";
}
} else {
if (have_option('u', 'uri')) {
if (!$quiet) { echo "Couldn't find an existing OStatus profile with that URI.\n"; }
if (!$quiet) {
echo "Couldn't find an existing OStatus profile with that URI.\n";
}
} else {
if (!$quiet) { echo "Couldn't find any existing OStatus profiles.\n"; }
if (!$quiet) {
echo "Couldn't find any existing OStatus profiles.\n";
}
}
exit(0);
}
while($lop->fetch()) {
if (!$quiet) { echo "Updating OStatus profile '{$lop->uri}' ... "; }
while ($lop->fetch()) {
if (!$quiet) {
echo "Updating OStatus profile '" . $lop->uri . "' ... ";
}
try {
$oprofile = pullOstatusProfile($lop->uri);
@ -257,13 +269,19 @@ while($lop->fetch()) {
$lop->avatar = $oprofile->avatar;
$lop->update($orig);
$lop->updateAvatar($oprofile->avatar, $forceUpdates);
if (!$quiet) { print "Done.\n"; }
if (!$quiet) {
echo 'Done.' . "\n";
}
}
} catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; }
if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_WARNING, $e->getMessage(), __FILE__);
// continue on error
}
}
if (!$quiet) { echo "OK.\n"; }
if (!$quiet) {
echo 'OK.' . "\n";
}

View File

@ -20,11 +20,12 @@
*
* @package Realtime
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2011, StatusNet, Inc.
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u';
$longoptions = array('universe');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = "e:";
@ -46,8 +50,10 @@ if (!empty($user)) {
$confirm->address_type = 'email';
if ($confirm->find(true)) {
$url = common_local_url('confirmfirstemail',
array('code' => $confirm->code));
$url = common_local_url(
'confirmfirstemail',
['code' => $confirm->code]
);
print "$url\n";
} else {
@ -68,8 +74,10 @@ $confirm->address_type = 'email';
$confirm->insert();
$url = common_local_url('confirmfirstemail',
array('code' => $confirm->code));
$url = common_local_url(
'confirmfirstemail',
['code' => $confirm->code]
);
print "$url\n";

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - a distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_UPDATECOUNTS_HELP
updatecounts.php [options]

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('base=', 'network');
@ -76,15 +80,29 @@ END;
*/
function sphinx_site_template($sn)
{
if (common_config('db', 'type') !== 'mysql') {
$created_ts = sprintf(
'((EXTRACT(DAY %1$s) * 24 + EXTRACT(HOUR %1$s)) * 60 + ' .
'EXTRACT(MINUTE %1$s)) * 60 + FLOOR(EXTRACT(SECOND %1$s)) AS "created_ts"',
'FROM ("created" - TIMESTAMP \'1970-01-01 00:00:00\')'
);
} else {
$created_ts = "timestampdiff(SECOND, '1970-01-01', `created`) AS `created_ts`";
}
return
sphinx_template($sn,
sphinx_template(
$sn,
'profile',
'SELECT id, UNIX_TIMESTAMP(created) as created_ts, nickname, fullname, location, bio, homepage FROM profile',
'SELECT * FROM profile where id = $id') .
sphinx_template($sn,
'SELECT id, ' . $created_ts . ', nickname, fullname, location, bio, homepage FROM profile',
'SELECT * FROM profile WHERE id = $id'
) .
sphinx_template(
$sn,
'notice',
'SELECT id, UNIX_TIMESTAMP(created) as created_ts, content FROM notice',
'SELECT * FROM notice where notice.id = $id AND notice.is_local != -2');
'SELECT id, ' . $created_ts . ', content FROM notice',
'SELECT * FROM notice WHERE notice.id = $id AND notice.is_local <> -2'
);
}
function sphinx_template($sn, $table, $query, $query_info)

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php
<?php
/*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 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/>.
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('base=', 'network');

View File

@ -1,33 +1,32 @@
#!/usr/bin/env php
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* GNU social - a federating social network
*
* GNU Social - StoreRemoteMediaPlugin
*
* LICENCE: 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/>.
* StoreRemoteMediaPlugin
*
* @category Plugin
* @package GNUsocial
* @copyright 2018 Free Software Foundation http://fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link https://www.gnu.org/software/social/
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2018 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
// Script author: Diogo Cordeiro <diogo@fc.up.pt>
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'l::a::i';
$longoptions = ['limit=', 'all', 'image'];

View File

@ -1,31 +1,30 @@
#!/usr/bin/env php
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* StatusNet, the distributed open-source microblogging tool
*
* PHP version 5
*
* LICENCE: 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/>.
*
* @category Plugin
* @package StatusNet
* @package GNUsocial
* @author Brion Vibber <brion@status.net>
* @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:';
$longoptions = array('nick=','import','all');
@ -46,9 +45,9 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
if (have_option('n')) {
$nickname = get_option_value('n');
} else if (have_option('nick')) {
} elseif (have_option('nick')) {
$nickname = get_option_value('nickname');
} else if (have_option('all')) {
} elseif (have_option('all')) {
$nickname = null;
} else {
show_help($helptext);
@ -57,7 +56,7 @@ if (have_option('n')) {
/**
*
* @param User $user
* @param User $user
* @return TwitterOAuthClient
*/
function twitterAuthForUser(User $user)
@ -115,8 +114,10 @@ foreach ($users as $id) {
throw new Exception("No user for id $id");
}
$auth = twitterAuthForUser($user);
$flink = Foreign_link::getByUserID($user->id,
TWITTER_SERVICE);
$flink = Foreign_link::getByUserID(
$user->id,
TWITTER_SERVICE
);
$friends->friends = $auth->friendsIds();
dumpMessage($flink, $friends);
@ -127,10 +128,10 @@ foreach ($users as $id) {
}
}
usort($output, function($a, $b) {
usort($output, function ($a, $b) {
if ($a->message->id < $b->message->id) {
return -1;
} else if ($a->message->id == $b->message->id) {
} elseif ($a->message->id == $b->message->id) {
return 0;
} else {
return 1;

View File

@ -18,11 +18,12 @@
/**
* @package TwitterBridge
* @author Evan Prodromou <evan@status.net>
* @copyright 2010, StatusNet, Inc.
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<ENDOFHELP
USAGE: initialize_notice_to_status.php

View File

@ -1,31 +1,30 @@
#!/usr/bin/env php
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social 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.
//
// GNU social 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 GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* StatusNet, the distributed open-source microblogging tool
*
* PHP version 5
*
* LICENCE: 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/>.
*
* @category Plugin
* @package StatusNet
* @package GNUsocial
* @author Brion Vibber <brion@status.net>
* @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:';
$longoptions = array('nick=','import','all','apiroot=');
@ -43,13 +42,13 @@ data as it comes.
ENDOFHELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
require_once INSTALLDIR . '/scripts/commandline.inc';
require_once dirname(dirname(__FILE__)) . '/lib/jsonstreamreader.php';
require_once dirname(dirname(__FILE__)) . '/lib/twitterstreamreader.php';
if (have_option('n')) {
$nickname = get_option_value('n');
} else if (have_option('nick')) {
} elseif (have_option('nick')) {
$nickname = get_option_value('nickname');
} else {
show_help($helptext);
@ -58,7 +57,7 @@ if (have_option('n')) {
/**
*
* @param User $user
* @param User $user
* @return TwitterOAuthClient
*/
function twitterAuthForUser(User $user)
@ -119,47 +118,61 @@ if (have_option('all')) {
}
$stream->hookEvent('raw', function($data, $context) {
$stream->hookEvent('raw', function ($data, $context) {
common_log(LOG_INFO, json_encode($data) . ' for ' . json_encode($context));
});
$stream->hookEvent('friends', function($data, $context) {
$stream->hookEvent('friends', function ($data, $context) {
printf("Friend list: %s\n", implode(', ', $data->friends));
});
$stream->hookEvent('favorite', function($data, $context) {
printf("%s favorited %s's notice: %s\n",
$data->source->screen_name,
$data->target->screen_name,
$data->target_object->text);
$stream->hookEvent('favorite', function ($data, $context) {
printf(
"%s favorited %s's notice: %s\n",
$data->source->screen_name,
$data->target->screen_name,
$data->target_object->text
);
});
$stream->hookEvent('unfavorite', function($data, $context) {
printf("%s unfavorited %s's notice: %s\n",
$data->source->screen_name,
$data->target->screen_name,
$data->target_object->text);
$stream->hookEvent('unfavorite', function ($data, $context) {
printf(
"%s unfavorited %s's notice: %s\n",
$data->source->screen_name,
$data->target->screen_name,
$data->target_object->text
);
});
$stream->hookEvent('follow', function($data, $context) {
printf("%s friended %s\n",
$data->source->screen_name,
$data->target->screen_name);
$stream->hookEvent('follow', function ($data, $context) {
printf(
'%s friended %s' . "\n",
$data->source->screen_name,
$data->target->screen_name
);
});
$stream->hookEvent('unfollow', function($data, $context) {
printf("%s unfriended %s\n",
$data->source->screen_name,
$data->target->screen_name);
$stream->hookEvent('unfollow', function ($data, $context) {
printf(
'%s unfriended %s' . "\n",
$data->source->screen_name,
$data->target->screen_name
);
});
$stream->hookEvent('delete', function($data, $context) {
printf("Deleted status notification: %s\n",
$data->status->id);
$stream->hookEvent('delete', function ($data, $context) {
printf(
'Deleted status notification: %s' . "\n",
$data->status->id
);
});
$stream->hookEvent('scrub_geo', function($data, $context) {
printf("Req to scrub geo data for user id %s up to status ID %s\n",
$data->user_id,
$data->up_to_status_id);
$stream->hookEvent('scrub_geo', function ($data, $context) {
printf(
'Req to scrub geo data for user id %s up to status ID %s' . "\n",
$data->user_id,
$data->up_to_status_id
);
});
$stream->hookEvent('status', function($data, $context) {
printf("Received status update from %s: %s\n",
$data->user->screen_name,
$data->text);
$stream->hookEvent('status', function ($data, $context) {
printf(
'Received status update from %s: %s' . "\n",
$data->user->screen_name,
$data->text
);
if (have_option('import')) {
$importer = new TwitterImport();
@ -170,38 +183,40 @@ $stream->hookEvent('status', function($data, $context) {
}
}
});
$stream->hookEvent('direct_message', function($data) {
printf("Direct message from %s to %s: %s\n",
$data->sender->screen_name,
$data->recipient->screen_name,
$data->text);
$stream->hookEvent('direct_message', function ($data) {
printf(
'Direct message from %s to %s: %s' . "\n",
$data->sender->screen_name,
$data->recipient->screen_name,
$data->text
);
});
class TwitterManager extends IoManager
{
function __construct(TwitterStreamReader $stream)
public function __construct(TwitterStreamReader $stream)
{
$this->stream = $stream;
}
function getSockets()
public function getSockets()
{
return $this->stream->getSockets();
}
function handleInput($data)
public function handleInput($data)
{
$this->stream->handleInput($data);
return true;
}
function start()
public function start()
{
$this->stream->connect();
return true;
}
function finish()
public function finish()
{
$this->stream->close();
return true;
@ -215,7 +230,7 @@ class TwitterManager extends IoManager
class TwitterStreamMaster extends IoMaster
{
function __construct($id, $ioManager)
public function __construct($id, $ioManager)
{
parent::__construct($id);
$this->ioManager = $ioManager;
@ -224,7 +239,7 @@ class TwitterStreamMaster extends IoMaster
/**
* Initialize IoManagers which are appropriate to this instance.
*/
function initManagers()
public function initManagers()
{
$this->instantiate($this->ioManager);
}