/** * Handles uploaded files. */ public function upload() { // save files $files = $this->parameters['__files']->getFiles(); $file = $files[0]; try { if (!$file->getValidationErrorType()) { $data = array('userID' => WCF::getUser()->userID ?: null, 'filename' => $file->getFilename(), 'fileType' => $file->getMimeType(), 'fileHash' => sha1_file($file->getLocation()), 'filesize' => $file->getFilesize(), 'uploadTime' => TIME_NOW); // save file $upload = FileUploadEditor::create($data); // move uploaded file if (@copy($file->getLocation(), $upload->getLocation())) { @unlink($file->getLocation()); // return result return array('uploadID' => $upload->uploadID, 'filename' => $upload->filename, 'filesize' => $upload->filesize, 'formattedFilesize' => FileUtil::formatFilesize($upload->filesize)); } else { // moving failed; delete file $editor = new FileUploadEditor($upload); $editor->delete(); throw new UserInputException('fileUpload', 'uploadFailed'); } } } catch (UserInputException $e) { $file->setValidationErrorType($e->getType()); } return array('errorType' => $file->getValidationErrorType()); }
/** * Returns a list of Moodle plugins supporting the mobile app. * * @return array an array of objects containing the plugin information */ public static function get_plugins_supporting_mobile() { global $CFG; require_once $CFG->libdir . '/adminlib.php'; $pluginsinfo = []; $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $plugintype => $unused) { // We need to include files here. $pluginswithfile = core_component::get_plugin_list_with_file($plugintype, 'db' . DIRECTORY_SEPARATOR . 'mobile.php'); foreach ($pluginswithfile as $plugin => $notused) { $path = core_component::get_plugin_directory($plugintype, $plugin); $component = $plugintype . '_' . $plugin; $version = get_component_version($component); require_once "{$path}/db/mobile.php"; foreach ($addons as $addonname => $addoninfo) { $plugininfo = array('component' => $component, 'version' => $version, 'addon' => $addonname, 'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : array(), 'fileurl' => '', 'filehash' => '', 'filesize' => 0); // All the mobile packages must be under the plugin mobile directory. $package = $path . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . $addonname . '.zip'; if (file_exists($package)) { $plugininfo['fileurl'] = $CFG->wwwroot . '' . str_replace($CFG->dirroot, '', $package); $plugininfo['filehash'] = sha1_file($package); $plugininfo['filesize'] = filesize($package); } $pluginsinfo[] = $plugininfo; } } } return $pluginsinfo; }
/** * Returns the SHA1 checksum of the given file * * @param string $file Path to file * * @return string Checksum or empty string if file doesn't exist */ public function checksum($file) { if (file_exists($file)) { return sha1_file($file); } return ''; }
public static function getDirsChecksums($_dir, $_opts = array()) { $dirs = is_array($_dir) ? $_dir : array($_dir); sort($dirs); $files = array(); $ignore = isset($_opts["ignore"]) ? $_opts["ignore"] : null; $substDir = isset($_opts["substDir"]) ? $_opts["substDir"] : false; foreach ($dirs as $dir) { $dirLength = strlen($dir); foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)) as $path => $fileinfo) { if (!$fileinfo->isFile()) { continue; } $key = $substDir ? substr($path, $dirLength) : $path; if (DIRECTORY_SEPARATOR !== "/") { $key = str_replace(DIRECTORY_SEPARATOR, "/", $key); } if ($ignore && preg_match($ignore, $key)) { continue; } $files[$key] = sha1_file($path); } } ksort($files); return $files; }
/** * {@inheritdoc} */ protected function processDeposit(Deposit $deposit) { $depositPath = $this->filePaths->getHarvestFile($deposit); if (!$this->fs->exists($depositPath)) { throw new Exception("Cannot find deposit bag {$depositPath}"); } $checksumValue = null; switch (strtoupper($deposit->getChecksumType())) { case 'SHA-1': case 'SHA1': $checksumValue = sha1_file($depositPath); break; case 'MD5': $checksumValue = md5_file($depositPath); break; default: throw new Exception("Deposit checksum type {$deposit->getChecksumType()} unknown."); } if (strtoupper($checksumValue) !== $deposit->getChecksumValue()) { $deposit->addErrorLog("Deposit checksum does not match. Expected {$deposit->getChecksumValue()} != Actual " . strtoupper($checksumValue)); $this->logger->warning("Deposit checksum does not match for deposit {$deposit->getDepositUuid()}"); return false; } $this->logger->info("Deposit {$depositPath} validated."); return true; }
/** * Run the database seeds. * * @return void */ public function run() { $videos = glob(public_path() . '/b/*'); usort($videos, function ($a, $b) { $a = (int) basename($a, '.webm'); $b = (int) basename($b, '.webm'); if ($a == $b) { return 0; } return $a < $b ? -1 : 1; }); $category = \App\Models\Category::where('shortname', '=', 'misc')->first(); $user = \App\Models\User::find(1); foreach ($videos as $video) { if (\App\Models\Video::whereFile(basename($video))->count() > 0) { continue; } $v = new \App\Models\Video(); $v->user()->associate($user); $v->category()->associate($category); $v->hash = sha1_file($video); $v->file = basename($video); $v->save(); } }
function compare($dir, $racine) { $retour = 'terminée avec succès.<br>'; $files = array_diff(scandir($dir), array('.', '..')); foreach ($files as $file) { if (is_dir($dir . $file)) { if (file_exists($racine . $file)) { compare($dir . $file . '/', $racine . $file . '/'); } else { mkdir($racine . $file); } } else { if (file_exists($racine . $file)) { $shaNow = sha1_file($racine . $file); $shaNext = sha1_file($dir . $file); if ($shaNow != $shaNext) { if (filemtime($dir . $file) >= filemtime($racine . $file)) { $retour .= $racine . $file . ' Le fichier actuel a une date de modification plus récente<br>'; } else { transfertFile($dir . '/' . $file, $racine . $file); } } } else { transfertFile($dir . '/' . $file, $racine . $file); } } } return $retour; }
public function readXmlDocument($file, $cli = false) { try { if ($cli) { if (!$file) { throw new XmlValidatorException("The file argument is missing!"); } else { if (!file_exists($file)) { throw new XmlValidatorException("The input file: " . $file . " does't exist!"); } else { if (!is_readable($file)) { throw new XmlValidatorException("Unbale to read input file: " . $file . "!"); } } } $this->hash = sha1_file($file); $this->file = $file; if ($this->cache_only) { return true; } } $this->document = new DOMDocument(); $this->document->load($file); $this->file = $file; } catch (Exception $e) { throw $e; } }
/** * @inheritdoc */ public function tasks() { return ['default' => ['.description' => 'Show map of subtasks', '.task' => ['class' => 'cookyii\\build\\tasks\\MapTask', 'task' => $this]], 'update' => ['.description' => 'Self update `cookyii/build` package', '.task' => ['class' => '\\cookyii\\build\\tasks\\CallableTask', 'handler' => function () { $source_url = 'http://cookyii.com/b/build.phar'; $checksum_url = 'http://cookyii.com/b/checksum'; $build_phar = $this->cwd . '/build.phar'; try { $checksum = file_get_contents($checksum_url); if ($checksum !== sha1_file($build_phar)) { $result = copy($source_url, $build_phar); if ($result) { $this->log('<task-result> COPY </task-result> `build.phar` updated to actual version.'); } else { $this->log('<task-error> ERR </task-error> Error updating `build.phar`'); } } else { $result = true; if ($this->output->isVerbose()) { $this->log('<task-result> OK </task-result> `build.phar` already updated.'); } } } catch (\Exception $e) { if ($this->output->isVerbose()) { $this->log('<task-error> ERR </task-error> Error updating `build.phar`'); } throw $e; } return $result; }]]]; }
public function setUp() { $this->image = realpath(APPLICATION_PATH . '/../' . self::PICTURE_LANDSCAPE); $this->hash = sha1_file($this->image); $this->adapter = $this->getMock('Zend_Cloud_StorageService_Adapter'); $this->service = new StorageService($this->adapter); }
/** * Download the remote Phar file. * * @param Updater $updater * * @throws \Exception on failure */ public function download(Updater $updater) { $version = $this->getCurrentRemoteVersion($updater); if ($version === false) { throw new \Exception('No remote versions found'); } $versionInfo = $this->getAvailableVersions(); if (!isset($versionInfo[$version]['url'])) { throw new \Exception(sprintf('Failed to find download URL for version %s', $version)); } if (!isset($versionInfo[$version]['sha1'])) { throw new \Exception(sprintf('Failed to find download checksum for version %s', $version)); } $downloadResult = file_get_contents($versionInfo[$version]['url']); if ($downloadResult === false) { throw new HttpRequestException(sprintf('Request to URL failed: %s', $versionInfo[$version]['url'])); } $saveResult = file_put_contents($updater->getTempPharFile(), $downloadResult); if ($saveResult === false) { throw new \Exception(sprintf('Failed to write file: %s', $updater->getTempPharFile())); } $tmpSha = sha1_file($updater->getTempPharFile()); if ($tmpSha !== $versionInfo[$version]['sha1']) { unlink($updater->getTempPharFile()); throw new \Exception(sprintf('The downloaded file does not have the expected SHA-1 hash: %s', $versionInfo[$version]['sha1'])); } }
function resetsha1() { $list = F('resetshalist'); if (empty($list)) { $list = M('Picture')->field('id,path')->select(); F('resetshalist', $list); F('resetshalistnum', count($list)); } $total = F('resetshalistnum'); $i = 1; foreach ($list as $key => $val) { $i++; $sha1 = sha1_file('.' . $val['path']); M('Picture')->where("id={$val['id']}")->save(array('sha1' => $sha1)); unset($list[$key]); if ($i > 1000 || empty($list)) { $num = count($list); if ($num > 0) { F('resetshalist', $list); $this->error('已经处理' . ($total - $num) . ',还有' . $num . '张'); } else { F('resetshalist', null); F('resetshalistnum', null); $this->success('SHA1重置成功,总共有' . $total . '张图片'); } break; } } }
/** * {@inheritdoc} */ public function execute(ConsumerEvent $event, $directory) { $sha1LockFile = sha1_file($this->workingTempPath . '/' . $directory . '/composer.lock'); $this->triggerSuccess($event, array('link' => '/assets/' . $sha1LockFile . '/vendor.zip')); $this->filesystem->remove($this->workingTempPath . '/' . $directory); return 0; }
function calculate_hash($string, $hash = 'MD5', $isFile = false) { $str = ''; if ($isFile) { switch ($hash) { case 'SHA1': $str = sha1_file($string); break; case 'MD5': default: $str = md5_file($string); break; } } else { switch ($hash) { case 'SHA1': $str = sha1($string); break; case 'MD5': default: $str = md5($string); break; } } return $str; }
function dl_apk($id) { $config = array("a" => "credentials_us.conf", "b" => "credentials_us_f1.conf", "3" => "credentials_us_f2.conf", "4" => "credentials_us_f3.conf", "5" => "credentials_us_f4.conf", "6" => "credentials_us_f5.conf"); $cfg = array_rand($config, 1); //$dl_cmd="python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d $id -f apkfiles -y -p -c credentials_us.conf"; $dl_cmd = "python /home/wwwroot/www.voteapps.com/terry/gplay-cli/gplay-cli.py -d {$id} -f /home/wwwroot/www.voteapps.com/apkfiles -y -p -c {$config[$cfg]}"; //echo $dl_cmd; //$dl_480="youtube-dl -f $f -o $path_480 https://www.youtube.com/watch?v=$dl_url"; //执行下载 exec($dl_cmd, $output, $return_var); //print_r($output); //print_r($return_var); //返回状态码 0 成功 1失败 $array[code] = $return_var; if ($return_var == '0') { $time = time(); $name = $id . $time . "[www.apkdigg.co]"; if (!file_exists("/home/wwwroot/www.voteapps.com/apkfiles/{$id}.apk")) { $array[code] = '1'; } else { rename("/home/wwwroot/www.voteapps.com/apkfiles/{$id}.apk", "/home/wwwroot/www.voteapps.com/apkfiles/{$name}.apk"); $array[file] = "apkfiles/{$name}.apk"; $array[sha] = sha1_file("/home/wwwroot/www.voteapps.com/apkfiles/{$name}.apk"); $pack_url = "/home/wwwroot/www.voteapps.com/apkfiles/{$name}.apk"; //$array[pack_info]= drupal_http_request($pack_url)->data; //$array[pack_info]= curldom($pack_url); $array['filemd5'] = md5_file($pack_url); $array[pack_info] = apkinfo($pack_url); // $array[pack_info]=get_permissions($pack_url); } } else { } return $array; }
/** * @param Configuration $config * @throws \Exception */ public function main(Configuration &$config) { $siteRoot = $config->get(array('task', 'siteRoot'), ''); $fileDir = $config->get(array('task', 'fileDir'), ''); if (empty($siteRoot)) { throw new \Exception('Task/Typo3/File: No site root defined.'); } if (empty($fileDir)) { throw new \Exception('Task/Typo3/File: No file directory defined.'); } // Empty data $this->data = []; // Trim slashes from paths $siteRoot = rtrim($siteRoot, '/'); $fileDir = '/' . trim($fileDir, '/'); // List files in the directory $files = new Directory($siteRoot . $fileDir); // Download files from remote server foreach ($files as $file) { // Connect to the file $identifier = $fileDir . '/' . $file->getFilename(); // File is invalid if ($file->getSize() === 0) { continue; } // Update record info with typo3 sys_file compatible data $this->data[] = ['identifier' => $identifier, 'storage' => 1, 'identifier_hash' => sha1($identifier), 'folder_hash' => sha1($fileDir), 'extension' => $file->getExtension(), 'mime_type' => MimeType::get($file->getFilename()), 'name' => $file->getFilename(), 'sha1' => sha1_file($file->getRealPath()), 'size' => $file->getSize(), 'tstamp' => time(), 'last_indexed' => time(), 'creation_date' => $file->getCTime(), 'modification_date' => $file->getMTime()]; } }
/** * @Route("/new", name="new") */ public function newAction(Request $request) { $file_root = $request->server->get('DOCUMENT_ROOT') . '/integrity/web/files/'; $comparison = new Comparison(); $form = $this->createFormBuilder($comparison)->add('first_file', FileType::class)->add('second_file', FileType::class)->add('save', SubmitType::class, array('label' => 'Submit'))->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($comparison); $em->flush(); if (is_file($file_root . $comparison->getFirstFileName()) && is_file($file_root . $comparison->getSecondFileName())) { if (sha1_file($file_root . $comparison->getFirstFileName()) === sha1_file($file_root . $comparison->getSecondFileName())) { $comparison->setPercentage('100'); $em->persist($comparison); $em->flush(); } else { similar_text(file_get_contents($file_root . $comparison->getFirstFileName()), file_get_contents($file_root . $comparison->getSecondFileName()), $percentage); $comparison->setPercentage($percentage); $em->persist($comparison); $em->flush(); } } return $this->redirectToRoute('view_item', array('id' => $comparison->getId())); } return $this->render('default/new.html.twig', ['base_dir' => realpath($this->container->getParameter('kernel.root_dir') . '/..'), 'form' => $form->createView()]); }
/** * Encrypts the data * @param string $data file name * @return string * @throws \InvalidArgumentException * @see sha1_file() */ public function encrypt($data) { if (!is_string($data)) { throw new \InvalidArgumentException('data'); } return sha1_file($data, $this->getRawOutput()); }
/** * Returns a URL with a prefix of a hash of the file's contents appended * to the filename. This is used for busting the cache and making sure browsers * can cache the asset until it changes. * * @param string $key * @return string */ public function hashedUrl($key) { $file = $this->path($key); $hash = substr(sha1_file($file), 0, 8); $parts = preg_split('/\\.(?=[^\\.]+$)/', $this->url($key)); return sprintf('%s.%s.%s', $parts[0], $hash, $parts[1]); }
function selfupdate($argv, $inPhar) { $opts = ['http' => ['method' => 'GET', 'header' => "User-agent: phpfmt fmt.phar selfupdate\r\n"]]; $context = stream_context_create($opts); // current release $releases = json_decode(file_get_contents('https://api.github.com/repos/phpfmt/fmt/tags', false, $context), true); $commit = json_decode(file_get_contents($releases[0]['commit']['url'], false, $context), true); $files = json_decode(file_get_contents($commit['commit']['tree']['url'], false, $context), true); foreach ($files['tree'] as $file) { if ('fmt.phar' == $file['path']) { $phar_file = base64_decode(json_decode(file_get_contents($file['url'], false, $context), true)['content']); } if ('fmt.phar.sha1' == $file['path']) { $phar_sha1 = base64_decode(json_decode(file_get_contents($file['url'], false, $context), true)['content']); } } if (!isset($phar_sha1) || !isset($phar_file)) { fwrite(STDERR, 'Could not autoupdate - not release found' . PHP_EOL); exit(255); } if ($inPhar && !file_exists($argv[0])) { $argv[0] = dirname(Phar::running(false)) . DIRECTORY_SEPARATOR . $argv[0]; } if (sha1_file($argv[0]) != $phar_sha1) { copy($argv[0], $argv[0] . '~'); file_put_contents($argv[0], $phar_file); chmod($argv[0], 0777 & ~umask()); fwrite(STDERR, 'Updated successfully' . PHP_EOL); exit(0); } fwrite(STDERR, 'Up-to-date!' . PHP_EOL); exit(0); }
/** * @return string */ public function getChecksum() { if (empty($this->checksum)) { $this->checksum = sha1_file($this->getPath()); } return (string) $this->checksum; }
function backupbuddy_hashGlob($root, $generate_sha1 = true, $excludes = array()) { $files = (array) pb_backupbuddy::$filesystem->deepglob($root); $root_len = strlen($root); $hashedFiles = array(); foreach ($files as $file_id => &$file) { $new_file = substr($file, $root_len); // If this file/directory begins with an exclusion then jump to next file/directory. foreach ($excludes as $exclude) { if (backupbuddy_startsWith($new_file, $exclude)) { continue 2; } } // Omit directories themselves. if (is_dir($file)) { continue; } $stat = stat($file); if (FALSE === $stat) { pb_backupbuddy::status('error', 'Unable to read file `' . $file . '` stat.'); } $hashedFiles[$new_file] = array('size' => $stat['size'], 'modified' => $stat['mtime']); if (true === $generate_sha1 && $stat['size'] < 1073741824) { // < 100mb $hashedFiles[$new_file]['sha1'] = sha1_file($file); } unset($files[$file_id]); // Better to free memory or leave out for performance? } unset($files); return $hashedFiles; }
public function dealUpload($file) { set_time_limit(30); /***获取sha1***/ $sha1 = sha1_file($file['tmp_name']); /***校验sha1***/ $file_cloud = config('config')->get('file_cloud'); $check = $this->curl($file_cloud['check'], ['sha1' => $sha1]); // var_dump($check);exit; $upload = ['appid' => $file_cloud['appid'], 'uploadToken' => $this->createToken(), 'filename' => $file['name']]; if (isset($check['error_code'])) { /******图片不存在的情况下,添加附件上传信息*******/ if ($check['error_code'] == 60006) { $upload['file'] = new \CURLFile($file['tmp_name'], $file['type'], $file['name']); } else { throw new InvalidResourceException('图片12服务器出现问题:' . $check['error'] . __LINE__); } } else { $upload['sha1'] = $sha1; } $result = $this->curl($file_cloud['write'], $upload); if (isset($result['error_code'])) { throw new InvalidResourceException('图片服务器出现问题: ' . __LINE__ . ' lines! error:' . $check['error']); } return ['status' => 'success', 'msg' => ['file_name' => $result['hash'] . '.' . $result['ext'], 'realname' => $file['name'], 'ext' => $result['ext'], 'size' => $file['size']]]; }
function getHash() { if (!file_exists($this->filename)) { return 0; } return sha1_file($this->filename); }
/** * Generates the SHA1 or returns the cached SHA1 hash for the file. * * @return string */ public function get_sha1() { if (!$this->sha1) { $this->sha1 = sha1_file($this->tempfile); } return $this->sha1; }
/** * @param $dir * @return $this */ protected function _searchDirectories($dir) { $rootDir = Mage::getBaseDir(); $excludeDirs = self::EXCLUDE_DIRS; if ($dir == Welance_Kraken_Model_Abstract::TYPE_MEDIA) { $excludeDirs .= '|catalog'; } $regexp = '/(' . $excludeDirs . ')/i'; $imageTypes = explode(';', self::ALLOWED_FILE_EXTENSIONS); $handle = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootDir . DS . $dir), RecursiveIteratorIterator::SELF_FIRST); $images = array(); foreach ($handle as $fullpath => $object) { $imageName = $object->getFileName(); if (preg_match($regexp, $object->getPath())) { continue; } if ($object->isDir()) { continue; } if (!$object->isReadable()) { Mage::log('not readable: ' . $fullpath, null, 'read.log'); continue; } if (!in_array($object->getExtension(), $imageTypes)) { continue; } $checksum = sha1_file($fullpath); $_dir = str_replace($rootDir . DS, '', $object->getPath()); $images[] = array('dir' => $_dir, 'name' => $imageName, 'checksum' => $checksum); } return $images; }
/** * Execute the action */ public function execute() { parent::execute(); // Get api key $this->apiKey = BackendModel::getModuleSetting($this->getModule(), 'api_key', null); // Get uncompressed images list $this->images = BackendCompressionModel::getImagesFromFolders(); if (!empty($this->images)) { // Compress each image from each folder $output = 'Compressing ' . count($this->images) . ' images...' . "<br />\r\n"; BackendCompressionModel::writeToCacheFile($output, true); foreach ($this->images as $image) { $tinyPNGApi = new TinyPNGApi($this->apiKey); // Shrink the image and check if succesful if ($tinyPNGApi->shrink($image['full_path'])) { // Check if the file was successfully downloaded. if ($tinyPNGApi->download($image['full_path'])) { $output = 'Compression succesful for image ' . $image['filename'] . '. Saved ' . number_format($tinyPNGApi->getSavingSize() / 1024, 2) . ' KB' . ' bytes. (' . $tinyPNGApi->getSavingPercentage() . '%)'; BackendCompressionModel::writeToCacheFile($output); // Save to db $imageInfo = array('filename' => $image['filename'], 'path' => $image['full_path'], 'original_size' => $tinyPNGApi->getInputSize(), 'compressed_size' => $tinyPNGApi->getOutputSize(), 'saved_bytes' => $tinyPNGApi->getSavingSize(), 'saved_percentage' => $tinyPNGApi->getSavingPercentage(), 'checksum_hash' => sha1_file($image['full_path']), 'compressed_on' => BackendModel::getUTCDate()); BackendCompressionModel::insertImageHistory($imageInfo, $image['file_compressed_before']); } } else { BackendCompressionModel::writeToCacheFile($tinyPNGApi->getErrorMessage()); } } BackendCompressionModel::writeToCacheFile("...Done!"); } else { BackendCompressionModel::writeToCacheFile('There are no images that can be compressed.', true); } // Print the output for debug purposes $output = BackendCompressionModel::readCacheFile(); print $output; }
function getFileHash($basef, $f, $outDir, $relativeDir = null) { global $g_hash; global $g_handledFiles; if ($relativeDir == null) { $relativeDir = dirname($basef); } $f0 = formatPath($relativeDir . "/{$f}"); $f1 = $outDir . "/" . $f0; $f2 = realpath($f1); if ($f2 === false || !array_key_exists($f0, $g_handledFiles)) { handleOne($f0, $outDir, true); } $f2 = realpath($f1); if ($f2 === false) { die("*** fail to find file `{$f}` base on `{$basef}` ({$f2})\n"); } @($hash = $g_hash[$f2]); if ($hash == null) { $hash = sha1_file($f2); $g_hash[$f2] = $hash; // echo("### hash {$f2}\n"); } else { // echo("### reuse hash({$f2})\n"); } return substr($hash, -6); }
/** * Creates an Image object from a file using a mock resource (in order to avoid a database resource pointer entry) * @param string $imagePathAndFilename * @return \TYPO3\Flow\Resource\Resource */ protected function getMockResourceByImagePath($imagePathAndFilename) { $imagePathAndFilename = \TYPO3\Flow\Utility\Files::getUnixStylePath($imagePathAndFilename); $hash = sha1_file($imagePathAndFilename); copy($imagePathAndFilename, 'resource://' . $hash); return $mockResource = $this->createMockResourceAndPointerFromHash($hash); }
public function getUniqueKey() { if (!$this->_id) { $this->_id = sha1_file($this->_xhbFile); } return $this->_id; }