Skip to content

Commit de498eb

Browse files
committed
made OB_UPLOADs mandatory, added to checker
1 parent c73a1fd commit de498eb

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

config.sample.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
define('OB_HASH_SALT', 'CHANGEMEPLEASE'); // change to random characters for password salt.
1313

1414
// make sure the following directories are writable by the web server.
15+
define('OB_UPLOADS', '/where/to/put/uploads');
1516
define('OB_MEDIA', '/where/to/put/media');
1617
define('OB_MEDIA_UNAPPROVED', '/where/to/put/media/unapproved'); // can be subdirectory of OB_MEDIA, but doesn't need to be.
1718
define('OB_MEDIA_ARCHIVE', '/where/to/put/media/archive'); // can be subdirectory of OB_MEDIA, but doesn't need to be.
@@ -53,9 +54,6 @@
5354
// where to media file versions (default is OB_MEDIA/versions)
5455
// define('OB_MEDIA_VERSIONS','/where/to/put/media/versions');
5556

56-
// set a custom uploads directory (required for multisite installations)
57-
// define('OB_UPLOADS', '/where/to/put/uploads');
58-
5957
// disable language/translation demos (translated using Google Translate, will contain many errors)
6058
// define('OB_DISABLE_LANGUAGE_DEMOS',TRUE);
6159

core/init.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
}
4444

4545
// set defaults if not set
46-
if (!defined('OB_UPLOADS')) {
47-
define('OB_UPLOADS', OB_LOCAL . '/uploads');
48-
}
4946
if (!defined('OB_MEDIA_FILESIZE_LIMIT')) {
5047
define('OB_MEDIA_FILESIZE_LIMIT', 1024);
5148
}

public/updates/checker.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public function config_file_valid()
128128
if (!defined('OB_HASH_SALT')) {
129129
$errors[] = 'OB_HASH_SALT (password hash salt) not set.';
130130
}
131+
if (!defined('OB_UPLOADS')) {
132+
$errors[] = 'OB_UPLOADS (uploads directory) not set.';
133+
}
131134
if (!defined('OB_MEDIA')) {
132135
$errors[] = 'OB_MEDIA (media directory) not set.';
133136
}
@@ -236,6 +239,12 @@ public function directories_valid()
236239
{
237240
$errors = [];
238241

242+
if (!is_dir(OB_UPLOADS)) {
243+
$errors[] = 'OB_UPLOADS (uploads directory) is not a valid directory.';
244+
} elseif (!is_writable(OB_UPLOADS)) {
245+
$errors[] = 'OB_UPLOADS (uploads directory) is not writable by the server.';
246+
}
247+
239248
if (!is_dir(OB_MEDIA)) {
240249
$errors[] = 'OB_MEDIA (media directory) is not a valid directory.';
241250
} elseif (!is_writable(OB_MEDIA)) {
@@ -266,16 +275,10 @@ public function directories_valid()
266275
$errors[] = 'OB_CACHE (cache directory) is not writable by the server.';
267276
}
268277

269-
if (!is_dir(OB_UPLOADS)) {
270-
$errors[] = 'The uploads directory does not exist.';
271-
} elseif (!is_writable(OB_UPLOADS)) {
272-
$errors[] = 'The uploads directory is not writable by the server.';
273-
}
274-
275278
if (count($errors) == 0) {
276279
// make sure there are no directories specified within the OB_CACHE directory
277280
$cache = realpath(OB_CACHE);
278-
foreach ([OB_MEDIA, OB_MEDIA_UNAPPROVED, OB_MEDIA_ARCHIVE, OB_THUMBNAILS, OB_UPLOADS] as $dir) {
281+
foreach ([OB_UPLOADS, OB_MEDIA, OB_MEDIA_UNAPPROVED, OB_MEDIA_ARCHIVE, OB_THUMBNAILS, OB_UPLOADS] as $dir) {
279282
if (strpos(realpath($dir), $cache) === 0) {
280283
$errors[] = 'Directory ' . $dir . ' is within the cache directory.';
281284
}

0 commit comments

Comments
 (0)