35     echo 
"To enable this script, change \$enabled to true.\n";
 
   36     echo 
"You *must* disable this script after a successful installation.\n";
 
   40 if (PHP_SAPI !== 
'cli') {
 
   41     echo 
"You must use the command line to run this script.";
 
   47 require_once 
"$elggRoot/vendor/autoload.php";
 
   56 if (is_writable(__FILE__)) {
 
   57     $code = file_get_contents(__FILE__);
 
   58     if (preg_match(
'~\\$enabled\\s*=\\s*(true|1)\\s*;~i', 
$code)) {
 
   60         $code = preg_replace(
'~\\$enabled\\s*=\\s*(true|1)\\s*;~i', 
'$enabled = false;', 
$code);
 
   61         file_put_contents(__FILE__, 
$code);
 
   63         echo 
"\nNote: This script has been disabled for your safety.\n";
 
   68 echo 
"\nWarning: You *must* disable this script by setting \$enabled = false;.\n";
 
   69 echo 
"Leaving this script enabled could endanger your installation.\n";
 
$enabled
Sample cli installer script.
 
if(! $enabled) if(PHP_SAPI !=='cli') $elggRoot