projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
685c8ef
)
add extension checking to config
author
Alan
<alan@roojs.com>
Mon, 24 Jul 2023 07:20:42 +0000
(15:20 +0800)
committer
Alan
<alan@roojs.com>
Mon, 24 Jul 2023 07:20:42 +0000
(15:20 +0800)
Config.php
patch
|
blob
|
history
UpdateDatabase.php
patch
|
blob
|
history
diff --git
a/Config.php
b/Config.php
index
25595a7
..
37f2da9
100644
(file)
--- a/
Config.php
+++ b/
Config.php
@@
-10,6
+10,14
@@
class Pman_Core_Config {
var $defaults = array( ); // override...
var $defaults = array( ); // override...
+ // note if other extended 'config's require more, then you porbably need to include these first.
+ var $required_extensions = array(
+ 'json',
+ 'curl',
+ 'gd',
+ 'mbstring'
+ );
+
function init($ff, $cfg)
{
function init($ff, $cfg)
{
@@
-22,6
+30,7
@@
class Pman_Core_Config {
}
}
}
}
+ $this->verifyExtensions();
return $cfg;
}
return $cfg;
}
@@
-73,6
+82,23
@@
class Pman_Core_Config {
return $cfg;
}
return $cfg;
}
-
+ function verifyExtensions()
+ {
+ $error = array();
+
+ foreach ($this->required_extensions as $e){
+
+ if(empty($e) || extension_loaded($e)) {
+ continue;
+ }
+
+ $error[] = "Error: Please install php extension: {$e}";
+ }
+
+ if(empty($error)){
+ return true;
+ }
+ die(implode('\n', $error));
+ }
}
}
diff --git
a/UpdateDatabase.php
b/UpdateDatabase.php
index
043a518
..
f7ac303
100644
(file)
--- a/
UpdateDatabase.php
+++ b/
UpdateDatabase.php
@@
-161,7
+161,8
@@
class Pman_Core_UpdateDatabase extends Pman
var $required_extensions = array(
'curl',
var $required_extensions = array(
'curl',
- 'gd'
+ 'gd',
+ 'mstring'
);
function getAuth() {
);
function getAuth() {