[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

@@ -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);