public function copy($sourceUrl, $destinationUrl) { $sourcePath = self::urlToPath($sourceUrl); $destinationPath = self::urlToPath($destinationUrl); $res = copy($sourcePath, $destinationPath); if (function_exists('exec')) { if (!$res && !(Lms_Text::uppercase(Lms_Text::substring(PHP_OS, 0, 3)) === 'WIN')) { exec("cp -r " . escapeshellarg($sourcePath) . " " . escapeshellarg($destinationPath)); return true; } } else { throw new Exception("Can't perform shell command. Probably 'exec' is disabled in your php.ini file"); } return $res; }