/** * Aborts current cache generation * Useful in case of a problem during generation of content (ie. exception) * * @throws ezpCacheClusterException */ public function abortCacheGeneration() { if (!isset($this->clusterCacheFile)) { throw new ezpCacheClusterException("Can't abort generation of non-existent cluster cache"); } $this->clusterCacheFile->abortCacheGeneration(); }
/** * @param string $text * @return string */ public function generateAndSaveImage( $text = null ) { if ( is_null( $text ) ) { ClusterTool::setCurrentCluster( $this->clusterIdentifier ); $text = ezpI18n::tr( $this->context, $this->source ); } $temp_file = sys_get_temp_dir() . "/misc" . uniqid() . '.png'; $convertExecutablePath = eZINI::instance( 'image.ini' )->variable( 'ImageMagick', 'ExecutablePath' ); $convertExecutable = eZINI::instance( 'image.ini' )->variable( 'ImageMagick', 'Executable' ); $cmd = "-background transparent -fill lightgray -font './extension/ezoscar/design/oscar/font/arial.ttf' -pointsize 11 label:{$text}"; exec( "$convertExecutablePath/$convertExecutable $cmd $temp_file" ); $imageFile = file_get_contents( $temp_file ); $this->fileUtils->storeContents( $imageFile ); unlink( $temp_file ); return $imageFile; }