mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
move os_mkdir to Stdio
This commit is contained in:
parent
c1549be36a
commit
46d3f4cc16
9 changed files with 20 additions and 22 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Code\Module;
|
||||
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
/**
|
||||
* @file Code/Module/Dav.php
|
||||
* @brief Initialize Hubzilla's cloud (SabreDAV).
|
||||
|
@ -98,7 +100,7 @@ class Dav extends Controller
|
|||
}
|
||||
|
||||
if (!is_dir('store')) {
|
||||
os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
|
||||
Stdio::mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
|
||||
}
|
||||
|
||||
if (argc() > 1) {
|
||||
|
|
|
@ -17,6 +17,7 @@ use Code\Lib\System;
|
|||
use Code\Web\Controller;
|
||||
use Code\Lib\Channel;
|
||||
use Code\Render\Theme;
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
/**
|
||||
* @brief Initialisation for the setup module.
|
||||
|
@ -640,7 +641,7 @@ class Setup extends Controller
|
|||
$status = true;
|
||||
$help = '';
|
||||
|
||||
@os_mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
|
||||
if (!is_writable(TEMPLATE_BUILD_PATH)) {
|
||||
$status = false;
|
||||
|
@ -662,7 +663,7 @@ class Setup extends Controller
|
|||
$status = true;
|
||||
$help = '';
|
||||
|
||||
@os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir('store', STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
|
||||
if (!is_writable('store')) {
|
||||
$status = false;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Code\Render;
|
|||
|
||||
use Smarty;
|
||||
use App;
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
class SmartyInterface extends Smarty
|
||||
{
|
||||
|
@ -38,7 +39,7 @@ class SmartyInterface extends Smarty
|
|||
$basecompiledir = str_replace('Code', '', dirname(__DIR__)) . TEMPLATE_BUILD_PATH;
|
||||
}
|
||||
if (!is_dir($basecompiledir)) {
|
||||
@os_mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
}
|
||||
if (!is_dir($basecompiledir)) {
|
||||
echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist.";
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Code\Render;
|
|||
|
||||
use App;
|
||||
use Code\Render\Theme;
|
||||
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
class SmartyTemplate implements TemplateEngine
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ class SmartyTemplate implements TemplateEngine
|
|||
$basecompiledir = str_replace('Code', '', dirname(__dir__)) . "/" . TEMPLATE_BUILD_PATH;
|
||||
}
|
||||
if (! is_dir($basecompiledir)) {
|
||||
@os_mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir(TEMPLATE_BUILD_PATH, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
if (! is_dir($basecompiledir)) {
|
||||
echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> does not exist.";
|
||||
killme();
|
||||
|
|
8
boot.php
8
boot.php
|
@ -1385,14 +1385,6 @@ function absurl($path) {
|
|||
return $path;
|
||||
}
|
||||
|
||||
function os_mkdir($path, $mode = 0777, $recursive = false) {
|
||||
$oldumask = @umask(0);
|
||||
$result = @mkdir($path, $mode, $recursive);
|
||||
@umask($oldumask);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recursively delete a directory.
|
||||
*
|
||||
|
|
|
@ -1203,7 +1203,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null)
|
|||
logger('basepath: ' . $os_basepath, LOGGER_DEBUG);
|
||||
|
||||
if (! is_dir($os_basepath)) {
|
||||
os_mkdir($os_basepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir($os_basepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
$os_basepath .= '/';
|
||||
|
@ -1317,7 +1317,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null)
|
|||
);
|
||||
|
||||
if ($r) {
|
||||
if (os_mkdir($os_basepath . $os_path, STORAGE_DEFAULT_PERMISSIONS, true)) {
|
||||
if (Stdio::mkdir($os_basepath . $os_path, STORAGE_DEFAULT_PERMISSIONS, true)) {
|
||||
$ret['success'] = true;
|
||||
|
||||
// update the parent folder's lastmodified timestamp
|
||||
|
@ -1376,7 +1376,7 @@ function attach_mkdirp($channel, $observer_hash, $arr = null)
|
|||
logger('basepath: ' . $basepath, LOGGER_DEBUG);
|
||||
|
||||
if (! is_dir($basepath)) {
|
||||
os_mkdir($basepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir($basepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
if (! perm_is_allowed($channel_id, $observer_hash, 'write_storage')) {
|
||||
|
@ -2791,7 +2791,7 @@ function save_chunk($channel, $start, $end, $len)
|
|||
$tmp_path = $_FILES['files']['tmp_name'];
|
||||
$new_base = 'cache/' . $channel['channel_address'] . '/tmp';
|
||||
|
||||
os_mkdir($new_base, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir($new_base, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
|
||||
if (! is_dir($new_base)) {
|
||||
logger('directory create failed for ' . $new_base);
|
||||
|
|
|
@ -13,6 +13,7 @@ use Code\Access\PermissionRoles;
|
|||
use Code\Access\PermissionLimits;
|
||||
use Code\Lib\Menu;
|
||||
use Code\Lib\MenuItem;
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
/**
|
||||
* @brief Import a channel.
|
||||
|
@ -1645,7 +1646,7 @@ function sync_files($channel, $files)
|
|||
// is this a directory?
|
||||
|
||||
if ($att['filetype'] === 'multipart/mixed' && $att['is_dir']) {
|
||||
os_mkdir($newfname, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir($newfname, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
$attachment_stored = true;
|
||||
continue;
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@ use Code\Lib\Addon;
|
|||
use Code\Web\HTTPSig;
|
||||
use Code\Daemon\Run;
|
||||
use Code\Extend\Hook;
|
||||
use Code\Storage\Stdio;
|
||||
|
||||
/**
|
||||
* @file include/network.php
|
||||
|
@ -1973,7 +1974,7 @@ function jsonld_document_loader($url)
|
|||
|
||||
$cachepath = 'cache/ldcache';
|
||||
if (! is_dir($cachepath)) {
|
||||
os_mkdir($cachepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir($cachepath, STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
$filename = $cachepath . '/' . urlencode($url);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Code\Lib\Channel;
|
||||
use Code\Extend\Hook;
|
||||
|
||||
use Code\Storage\Stdio;
|
||||
/**
|
||||
* @file include/security.php
|
||||
*
|
||||
|
@ -332,7 +332,7 @@ function change_channel($change_channel)
|
|||
App::set_perms(get_all_perms(local_channel(), $hash));
|
||||
}
|
||||
if (! is_dir('store/' . $r[0]['channel_address'])) {
|
||||
@os_mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
Stdio::mkdir('store/' . $r[0]['channel_address'], STORAGE_DEFAULT_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
$arr = [ 'channel_id' => $change_channel, 'chanx' => $ret ];
|
||||
|
|
Loading…
Reference in a new issue