1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
3 changed files with 40 additions and 1 deletions
Showing only changes of commit fa31416932 - Show all commits

View file

@ -17,6 +17,7 @@
use ncc\Exceptions\RuntimeException;
use ncc\ncc;
use ncc\Utilities\Console;
use ncc\Utilities\Functions;
use ncc\Utilities\Resolver;
use ncc\Utilities\RuntimeCache;
@ -182,8 +183,8 @@
*/
public static function shutdown(): void
{
Console::outDebug('clearing cache');
RuntimeCache::clearCache();
Functions::finalizePermissions();
}
}

View file

@ -942,4 +942,40 @@
return (string)$input;
}
/**
* Finalizes the permissions
*
* @return void
* @throws InvalidScopeException
*/
public static function finalizePermissions()
{
if(Resolver::resolveScope() !== Scopes::System)
return;
Console::outVerbose('Finalizing permissions...');
$filesystem = new Filesystem();
try
{
if($filesystem->exists(PathFinder::getDataPath() . DIRECTORY_SEPARATOR . 'data'))
$filesystem->chmod(PathFinder::getDataPath() . DIRECTORY_SEPARATOR . 'data', 0777, 0000, true);
}
catch(Exception $e)
{
Console::outWarning(sprintf('Failed to finalize permissions for %s: %s', PathFinder::getDataPath() . DIRECTORY_SEPARATOR . 'data', $e->getMessage()));
}
try
{
if($filesystem->exists(PathFinder::getCachePath()))
$filesystem->chmod(PathFinder::getCachePath(), 0777, 0000, true);
}
catch(Exception $e)
{
Console::outWarning(sprintf('Failed to finalize permissions for %s: %s', PathFinder::getDataPath() . DIRECTORY_SEPARATOR . 'data', $e->getMessage()));
}
}
}

View file

@ -86,6 +86,8 @@
*/
public static function clearCache(bool $clear_memory=true, bool $clear_files=true): void
{
Console::outDebug('clearing cache');
if($clear_memory)
{
Console::outDebug(sprintf('clearing memory cache (%d entries)', count(self::$cache)));