[SCRIPTS] Set PUBLICDIR in plugin scripts as well
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user