diff --git a/scripts/allsites.php b/scripts/allsites.php
index 211728c497..c23685c721 100755
--- a/scripts/allsites.php
+++ b/scripts/allsites.php
@@ -20,7 +20,8 @@
// Abort if called from a web server
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 't:w:';
$longoptions = array('tagged=', 'not-tagged=');
diff --git a/scripts/backupuser.php b/scripts/backupuser.php
index 740ae25d44..2a9ace4926 100644
--- a/scripts/backupuser.php
+++ b/scripts/backupuser.php
@@ -17,7 +17,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:f:a:j';
$longoptions = array('id=', 'nickname=', 'file=', 'after=', 'json');
diff --git a/scripts/checkschema.php b/scripts/checkschema.php
index 584f7a39e7..bb9ca31aa2 100755
--- a/scripts/checkschema.php
+++ b/scripts/checkschema.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'x::';
$longoptions = array('extensions=');
diff --git a/scripts/clean_file_table.php b/scripts/clean_file_table.php
index 573abf1ed0..2444a4bb69 100755
--- a/scripts/clean_file_table.php
+++ b/scripts/clean_file_table.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'y';
$longoptions = array('yes');
diff --git a/scripts/clean_profiles.php b/scripts/clean_profiles.php
index 470d6c1b91..245b2ef5c7 100755
--- a/scripts/clean_profiles.php
+++ b/scripts/clean_profiles.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'y';
$longoptions = array('yes');
diff --git a/scripts/clean_thumbnails.php b/scripts/clean_thumbnails.php
index aef3f54aff..dd3e9a0875 100755
--- a/scripts/clean_thumbnails.php
+++ b/scripts/clean_thumbnails.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'y';
$longoptions = array('yes');
diff --git a/scripts/clear_jabber.php b/scripts/clear_jabber.php
index 4ba24c275a..eababeda21 100755
--- a/scripts/clear_jabber.php
+++ b/scripts/clear_jabber.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::n::y';
$longoptions = array('id=', 'nickname=', 'yes', 'all', 'dry-run');
diff --git a/scripts/clearcache.php b/scripts/clearcache.php
index c67d6275d8..bf590ef69c 100755
--- a/scripts/clearcache.php
+++ b/scripts/clearcache.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = "t:l:v:k:";
diff --git a/scripts/command.php b/scripts/command.php
index 1dbf7f6a7f..182518d0aa 100755
--- a/scripts/command.php
+++ b/scripts/command.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(__DIR__ . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:o';
$longoptions = array('id=', 'nickname=', 'owner');
diff --git a/scripts/console.php b/scripts/console.php
index 25d12e52e1..3424c7b244 100644
--- a/scripts/console.php
+++ b/scripts/console.php
@@ -24,7 +24,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
-define('INSTALLDIR', dirname(__FILE__));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('GNUSOCIAL', true);
define('STATUSNET', true);
diff --git a/scripts/createsim.php b/scripts/createsim.php
index 624043161d..0e6d807442 100755
--- a/scripts/createsim.php
+++ b/scripts/createsim.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'b:g:j:n:t:u:w:x:z:';
$longoptions = array(
diff --git a/scripts/delete_notice.php b/scripts/delete_notice.php
index cd29cffc15..f2350f8733 100755
--- a/scripts/delete_notice.php
+++ b/scripts/delete_notice.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::u::y';
$longoptions = array('id=', 'uri=', 'yes');
diff --git a/scripts/delete_orphan_files.php b/scripts/delete_orphan_files.php
index 2c49c10a50..8c1212ef51 100755
--- a/scripts/delete_orphan_files.php
+++ b/scripts/delete_orphan_files.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'y';
$longoptions = array('yes');
diff --git a/scripts/deletegroup.php b/scripts/deletegroup.php
index f76a3dedc7..33a5789a16 100755
--- a/scripts/deletegroup.php
+++ b/scripts/deletegroup.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::n::y';
$longoptions = array('id=', 'nickname=', 'yes');
diff --git a/scripts/deleteprofile.php b/scripts/deleteprofile.php
index 8eed6ff97b..eb427f426d 100755
--- a/scripts/deleteprofile.php
+++ b/scripts/deleteprofile.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::n::u::y';
$longoptions = array('id=', 'nickname=', 'uri=', 'yes');
diff --git a/scripts/docgen.php b/scripts/docgen.php
index 607ee0328d..e8731a7d5a 100755
--- a/scripts/docgen.php
+++ b/scripts/docgen.php
@@ -17,6 +17,7 @@ Options:
ENDOFHELP;
define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
set_include_path(INSTALLDIR . DIRECTORY_SEPARATOR . 'extlib' . PATH_SEPARATOR . get_include_path());
$pattern = "*.php *.inc";
diff --git a/scripts/dumpschema.php b/scripts/dumpschema.php
index 9c5e3cf8b3..ba159afdb9 100755
--- a/scripts/dumpschema.php
+++ b/scripts/dumpschema.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('dry-run', 'start=', 'end=');
diff --git a/scripts/fixup_hashtags.php b/scripts/fixup_hashtags.php
index b5cdb76498..343c9ee144 100755
--- a/scripts/fixup_hashtags.php
+++ b/scripts/fixup_hashtags.php
@@ -24,7 +24,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
exit();
}
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('GNUSOCIAL', true);
define('STATUSNET', true); // compatibility
diff --git a/scripts/flushrouter.php b/scripts/flushrouter.php
index 51178a725c..8bfb6febdc 100755
--- a/scripts/flushrouter.php
+++ b/scripts/flushrouter.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<
@@ -31,4 +32,4 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
$cache = Cache::instance();
$cache->delete(Router::cacheKey());
-print "OK.\n";
\ No newline at end of file
+print "OK.\n";
diff --git a/scripts/flushsite.php b/scripts/flushsite.php
index b7f385ac45..207b0e9035 100755
--- a/scripts/flushsite.php
+++ b/scripts/flushsite.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd';
$longoptions = array('delete');
@@ -42,4 +43,4 @@ if (empty($sn)) {
print "Flushing cache for {$nickname}...";
$sn->decache();
-print "OK.\n";
\ No newline at end of file
+print "OK.\n";
diff --git a/scripts/getpiddir.php b/scripts/getpiddir.php
index 8274c37c0f..4c8e8b221c 100755
--- a/scripts/getpiddir.php
+++ b/scripts/getpiddir.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<
diff --git a/scripts/imdaemon.php b/scripts/imdaemon.php
index 0298c00522..96b4e0dfeb 100755
--- a/scripts/imdaemon.php
+++ b/scripts/imdaemon.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'fi::a';
$longoptions = array('id::', 'foreground', 'all');
diff --git a/scripts/importtwitteratom.php b/scripts/importtwitteratom.php
index 2a4cb7fc41..0cfcba0424 100755
--- a/scripts/importtwitteratom.php
+++ b/scripts/importtwitteratom.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:f:';
$longoptions = array('id=', 'nickname=', 'file=');
diff --git a/scripts/install_cli.php b/scripts/install_cli.php
index cb1ef4c0e1..e4f8f600b1 100755
--- a/scripts/install_cli.php
+++ b/scripts/install_cli.php
@@ -31,6 +31,7 @@ if (php_sapi_name() !== 'cli') {
}
define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib');
require_once INSTALLDIR . '/lib/installer.php';
diff --git a/scripts/joingroup.php b/scripts/joingroup.php
index bd73cbe794..782362cbf1 100644
--- a/scripts/joingroup.php
+++ b/scripts/joingroup.php
@@ -17,7 +17,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:g:G:';
$longoptions = array('id=', 'nickname=', 'group=', 'group-id=');
diff --git a/scripts/leavegroup.php b/scripts/leavegroup.php
index 8f9ef33e7e..4bece427f4 100644
--- a/scripts/leavegroup.php
+++ b/scripts/leavegroup.php
@@ -17,7 +17,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:g:G:';
$longoptions = array('id=', 'nickname=', 'group=', 'group-id=');
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 3b1ef96a1e..809e97038d 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'g:n:';
$longoptions = array('nickname=', 'group=');
diff --git a/scripts/moveuser.php b/scripts/moveuser.php
index 17b3e0fb67..de75541932 100644
--- a/scripts/moveuser.php
+++ b/scripts/moveuser.php
@@ -17,7 +17,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:r:w:y';
$longoptions = array('id=', 'nickname=', 'remote=', 'password=');
diff --git a/scripts/nukefile.php b/scripts/nukefile.php
index 4001833e8c..e3073de104 100755
--- a/scripts/nukefile.php
+++ b/scripts/nukefile.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::yv';
$longoptions = array('id=', 'yes', 'verbose');
diff --git a/scripts/queuectl.php b/scripts/queuectl.php
index 1c9ea33536..124ba60ae5 100755
--- a/scripts/queuectl.php
+++ b/scripts/queuectl.php
@@ -25,7 +25,8 @@
* @package QueueHandler
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'ur';
$longoptions = array('update', 'restart', 'stop');
diff --git a/scripts/queuedaemon.php b/scripts/queuedaemon.php
index e5dc1af810..6d7cfcf222 100755
--- a/scripts/queuedaemon.php
+++ b/scripts/queuedaemon.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'fi:at:';
$longoptions = array('id=', 'foreground', 'all', 'threads=');
diff --git a/scripts/registeruser.php b/scripts/registeruser.php
index 97caf645cd..b90f3615e0 100755
--- a/scripts/registeruser.php
+++ b/scripts/registeruser.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:w:f:e:';
$longoptions = array('nickname=', 'password=', 'fullname=', 'email=');
diff --git a/scripts/remove_duplicate_file_urls.php b/scripts/remove_duplicate_file_urls.php
index a4a7cd795b..9754820d98 100755
--- a/scripts/remove_duplicate_file_urls.php
+++ b/scripts/remove_duplicate_file_urls.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'y';
$longoptions = array('yes');
diff --git a/scripts/resend_confirm_address.php b/scripts/resend_confirm_address.php
index b73246d6ef..8a456a812c 100755
--- a/scripts/resend_confirm_address.php
+++ b/scripts/resend_confirm_address.php
@@ -1,7 +1,8 @@
#!/usr/bin/env php
.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:f:';
$longoptions = array('id=', 'nickname=', 'file=');
diff --git a/scripts/sendemail.php b/scripts/sendemail.php
index d41f96564a..e18ad36c77 100755
--- a/scripts/sendemail.php
+++ b/scripts/sendemail.php
@@ -23,7 +23,8 @@
* @link https://www.gnu.org/software/social/
*/
-define('INSTALLDIR', realpath(dirname(__DIR__)));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:a:';
$longoptions = ['id=', 'nickname=', 'subject=', 'all='];
diff --git a/scripts/sessiongc.php b/scripts/sessiongc.php
index a2ca203889..2a6afa0996 100755
--- a/scripts/sessiongc.php
+++ b/scripts/sessiongc.php
@@ -16,6 +16,7 @@
// along with GNU social. If not, see .
define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'da';
$longoptions = array('delete', 'all');
diff --git a/scripts/setpassword.php b/scripts/setpassword.php
index 66964b2a08..1c6597c8c2 100755
--- a/scripts/setpassword.php
+++ b/scripts/setpassword.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<
diff --git a/scripts/settag.php b/scripts/settag.php
index 19abce43c8..fac44146d6 100755
--- a/scripts/settag.php
+++ b/scripts/settag.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd';
$longoptions = array('delete');
diff --git a/scripts/showcache.php b/scripts/showcache.php
index 8ef08467d6..991105454e 100755
--- a/scripts/showcache.php
+++ b/scripts/showcache.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = "t:l:v:k:";
diff --git a/scripts/showplugins.php b/scripts/showplugins.php
index e79b4e7224..4ec2f00274 100755
--- a/scripts/showplugins.php
+++ b/scripts/showplugins.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
require_once INSTALLDIR.'/scripts/commandline.inc';
diff --git a/scripts/showtable.php b/scripts/showtable.php
index eb18a98e20..9746367b29 100755
--- a/scripts/showtable.php
+++ b/scripts/showtable.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<
diff --git a/scripts/simple_console.php b/scripts/simple_console.php
index 7df05fd6e9..721fbab546 100644
--- a/scripts/simple_console.php
+++ b/scripts/simple_console.php
@@ -20,7 +20,8 @@
// Abort if called from a web server
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i::n::y';
$longoptions = array('id=', 'nickname=', 'yes', 'dry-run', 'all');
diff --git a/scripts/uncache_users.php b/scripts/uncache_users.php
index b5955fd5aa..afb971b128 100755
--- a/scripts/uncache_users.php
+++ b/scripts/uncache_users.php
@@ -17,7 +17,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<
diff --git a/scripts/update_po_templates.php b/scripts/update_po_templates.php
index a5730e6d2f..c77d7e8a91 100755
--- a/scripts/update_po_templates.php
+++ b/scripts/update_po_templates.php
@@ -24,7 +24,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
exit();
}
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
function update_core($dir, $domain)
{
diff --git a/scripts/update_translations.php b/scripts/update_translations.php
index e204e747c8..72ea81bdb6 100755
--- a/scripts/update_translations.php
+++ b/scripts/update_translations.php
@@ -24,7 +24,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
exit();
}
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('GNUSOCIAL', true);
define('STATUSNET', true); // compatibility
diff --git a/scripts/updatelocation.php b/scripts/updatelocation.php
index abf9627cc7..6a78693251 100755
--- a/scripts/updatelocation.php
+++ b/scripts/updatelocation.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:af';
$longoptions = array('id=', 'nickname=', 'all', 'force');
diff --git a/scripts/updateurls.php b/scripts/updateurls.php
index 8657d80b84..f4b57f0723 100755
--- a/scripts/updateurls.php
+++ b/scripts/updateurls.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = '';
$longoptions = array();
diff --git a/scripts/upgrade.php b/scripts/upgrade.php
index 6d419e1416..92e1c87c9d 100755
--- a/scripts/upgrade.php
+++ b/scripts/upgrade.php
@@ -28,6 +28,7 @@
*/
define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'dfx::';
$longoptions = ['debug', 'files', 'extensions='];
diff --git a/scripts/useremail.php b/scripts/useremail.php
index 02c34678fb..d689953245 100755
--- a/scripts/useremail.php
+++ b/scripts/useremail.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:e:';
$longoptions = array('id=', 'nickname=', 'email=');
diff --git a/scripts/userrole.php b/scripts/userrole.php
index 92f6b685bd..428abb8ace 100755
--- a/scripts/userrole.php
+++ b/scripts/userrole.php
@@ -18,7 +18,8 @@
* along with this program. If not, see .
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:r:d';
$longoptions = array('id=', 'nickname=', 'role=', 'delete');