Ejemplo n.º 1
0
 /**
  * Setup user folder
  */
 private function setupUserFolder($session)
 {
     $dirName = EIcmsHelper::generateRandomString(8) . '_' . time() . '/';
     $dirPath = EIconfig::$coreDirectoryPath . $dirName;
     mkdir($dirPath, 0755);
     $session->set('user_folder', $dirName);
 }
Ejemplo n.º 2
0
 public static function removeDir($dir)
 {
     if (!is_dir($dir)) {
         throw new InvalidArgumentException("{$dir} must be a directory");
     }
     if (is_dir($dir)) {
         $objects = scandir($dir);
         foreach ($objects as $object) {
             if ($object != "." && $object != "..") {
                 if (filetype($dir . "/" . $object) == "dir") {
                     EIcmsHelper::removeDir($dir . "/" . $object);
                 } else {
                     unlink($dir . "/" . $object);
                 }
             }
         }
         reset($objects);
         rmdir($dir);
     }
 }
Ejemplo n.º 3
0
 public function getFullPackageForLanguage($language)
 {
     $wp = EIcmsHelper::performGetRequest(self::versionURLlocale . $language);
     $package = $wp->offers[0]->packages->full;
     return $package;
 }
 /**
  * @Route("wp-cleanup", name="_wp-cleanup")
  */
 public function cleanup(Request $request)
 {
     $session = $request->getSession();
     $userDir = $session->get('user_folder');
     $response = new JsonResponse();
     EIcmsHelper::deleteDatabase($session->get('dbName'));
     EIcmsHelper::removeDir(EIconfig::$coreDirectoryPath . $userDir);
     $response->setData(array('action' => 'Cleaning up', 'status' => 'success'));
     return $response;
 }