Example #1
0
function jsave_put($path, $data)
{
    global $DATA_path_, $FULL_path_;
    $file = "{$path}.json";
    $fold = dirname($path);
    if (!empty($path) && !empty($data)) {
        ensureDir("{$FULL_path_}{$fold}");
        file_put_contents("{$FULL_path_}{$file}", $data);
    }
    return "{$DATA_path_}{$file}";
}
Example #2
0
function picSaver($pic)
{
    global $dbg, $dir;
    if (!empty($pic)) {
        $pair = splitData($pic);
    }
    if (!empty($pair[1])) {
        ensureDir($dir);
        file_put_contents($dir . $pair[0] . '.jpg', base64_decode($pair[1]));
    }
    if ($dbg) {
        //print_r($pair);
    }
}
 /**
  * Initializes the application after installation, or reinitializes it afterwards
  *
  * Note: this is automatically called after `composer install` runs.
  *
  * @param array $opts
  * @option $overwrite|o Discards the current configuration if it already exists
  */
 function init($opts = ['overwrite|o' => false])
 {
     $io = $this->io;
     $envPath = "{$this->kernelSettings->baseDirectory}/.env";
     $io->clear()->banner("Electro Configuration Wizard");
     $overwrite = get($opts, 'overwrite');
     if (file_exists($envPath) && !$overwrite) {
         $io->say("<warning>The application is already configured</warning>")->comment("Use -o to overwrite the current configuration");
     } else {
         $this->nestedExec = true;
         ensureDir("{$this->kernelSettings->baseDirectory}/{$this->kernelSettings->modulesPath}");
         ensureDir("{$this->kernelSettings->baseDirectory}/{$this->kernelSettings->pluginModulesPath}");
         $this->initStorage();
         $this->initConfig(['overwrite' => true]);
     }
     // (Re)initialize all plugins and private modules.
     $io->title('Initializing modules');
     /** @var $this CoreTasks */
     foreach ($this->modulesRegistry->onlyPrivateOrPlugins()->getModuleNames() as $moduleName) {
         $this->modulesInstaller->setupModule($moduleName, true);
     }
     $io->done("Initialization completed successfully");
 }