Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -11,28 +11,33 @@
|
||||
namespace IPS\Application;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use function count;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Developer class used for IN_DEV management
|
||||
*/
|
||||
class _Developer extends \IPS\Application
|
||||
class Developer extends Application
|
||||
{
|
||||
/**
|
||||
* @brief Array of directories that should always be present inside /dev
|
||||
*/
|
||||
protected static $devDirs = array( 'css', 'email', 'html', 'img', 'js' );
|
||||
protected static array $devDirs = array( 'css', 'email', 'html', 'img', 'js' );
|
||||
|
||||
/**
|
||||
* Returns NULL or a list of missing IN_DEV required directories
|
||||
*
|
||||
* @return NULL|array Null if all directories are present, or an array of directory names ('dev', 'dev/css', 'dev/email',... )
|
||||
*/
|
||||
public function getMissingDirectories()
|
||||
public function getMissingDirectories(): ?array
|
||||
{
|
||||
$path = \IPS\ROOT_PATH . '/' . $this->directory . '/dev';
|
||||
$missing = array();
|
||||
@@ -50,24 +55,24 @@ class _Developer extends \IPS\Application
|
||||
}
|
||||
}
|
||||
|
||||
return ( \count( $missing ) ) ? $missing : null;
|
||||
return ( count( $missing ) ) ? $missing : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns NULL or a list of unwritable directories
|
||||
*
|
||||
* @return NULL|Array Null if all directories are writeable, or an array of directory names ('dev', 'dev/css', 'dev/email',... )
|
||||
*
|
||||
* @return NULL|array Null if all directories are writeable, or an array of directory names ('dev', 'dev/css', 'dev/email',... )
|
||||
*/
|
||||
public function getUnwritableDirectories()
|
||||
public function getUnwritableDirectories(): array|null
|
||||
{
|
||||
$path = \IPS\ROOT_PATH . '/' . $this->directory . '/dev';
|
||||
$unwriteable = array();
|
||||
|
||||
|
||||
if ( ! is_writeable( $path ) )
|
||||
{
|
||||
return array( 'dev' );
|
||||
}
|
||||
|
||||
|
||||
foreach( static::$devDirs as $dir )
|
||||
{
|
||||
if ( ! is_writeable( $path . '/' . $dir ) )
|
||||
@@ -75,7 +80,7 @@ class _Developer extends \IPS\Application
|
||||
$unwriteable[] = $dir;
|
||||
}
|
||||
}
|
||||
|
||||
return ( \count( $unwriteable ) ) ? $unwriteable : null;
|
||||
|
||||
return ( count( $unwriteable ) ) ? $unwriteable : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user