当前位置: 首页>>代码示例>>PHP>>正文


PHP myContentStorage::fullMkdir方法代码示例

本文整理汇总了PHP中myContentStorage::fullMkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP myContentStorage::fullMkdir方法的具体用法?PHP myContentStorage::fullMkdir怎么用?PHP myContentStorage::fullMkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在myContentStorage的用法示例。


在下文中一共展示了myContentStorage::fullMkdir方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uploadFileByToken

 public static function uploadFileByToken($file_data, $token, $filename, $extra_id = null, $create_thumb = false)
 {
     KalturaLog::log("Trace while uploading1 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true));
     $origFilename = @$file_data['name'];
     if (!$origFilename) {
         KalturaLog::log("Error while uploading, file does not have a name. [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\nerror: [" . @$file_data["error"] . "]");
         return;
     }
     $parts = pathinfo($origFilename);
     $extension = @strtolower($parts['extension']);
     /*
     		$filename = $token .'_'. $filename;
     		// add the file extension after the "." character
     		$fullPath = myContentStorage::getFSUploadsPath().$filename . ( $extra_id ? "_" . $extra_id : "" ) .".".$extension;
     */
     list($fullPath, $fullUrl) = self::getUploadPathAndUrl($token, $filename, $extra_id, $extension);
     KalturaLog::log("Trace while uploading2 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
     // start tracking what will hopefully become an entry
     $te = new TrackEntry();
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_UPLOADED_FILE);
     $te->setParam1Str($token);
     $te->setParam2Str($filename);
     $te->setParam3Str($fullPath);
     $te->setDescription(__METHOD__ . ":" . __LINE__);
     TrackEntry::addTrackEntry($te);
     myContentStorage::fullMkdir($fullPath);
     if (!move_uploaded_file($file_data['tmp_name'], $fullPath)) {
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
         $err = array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "error" => @$file_data["error"]);
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]" . "\n" . print_r($err, true));
         return $err;
     }
     chmod($fullPath, 0777);
     $upload_server_header = isset($_SERVER["HTTP_X_KALTURA_SERVER"]) ? $_SERVER["HTTP_X_KALTURA_SERVER"] : null;
     $thumb_created = false;
     // if the file originated from a kaltura upload server we dont need a thumbnail (kuploader)
     if ($create_thumb && !$upload_server_header) {
         $thumbFullPath = self::getThumbnailPath($fullPath, ".jpg");
         kFile::fullMkdir($thumbFullPath);
         KalturaLog::log("Thumbnail full path [{$thumbFullPath}]");
         if (myContentStorage::fileExtAccepted($extension)) {
             KalturaLog::log("Generating image thumbnail");
             myFileConverter::createImageThumbnail($fullPath, $thumbFullPath, "image2");
             $thumb_url = self::getThumbnailPath($fullUrl, ".jpg");
             $thumb_created = file_exists($thumbFullPath);
         } elseif (myContentStorage::fileExtNeedConversion($extension)) {
             KalturaLog::log("Generating media thumbnail");
             myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 3);
             if (!file_exists($thumbFullPath)) {
                 myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 0);
             }
         }
     }
     if (!$thumb_created) {
         KalturaLog::log("Thumbnail not generated");
         // in this case no thumbnail was created - don't extract false data
         $thumb_url = "";
     }
     return array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "thumb_url" => $thumb_url, "thumb_created" => $thumb_created);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:60,代码来源:myUploadUtils.class.php

示例2: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $filename = $this->getP('filename');
     // strip the filename from invalid characters
     $token = $this->getKsUniqueString();
     //		$res = myUploadUtils::uploadFileByToken ( $_FILES['Filedata'] , $token , $filename );
     $origFilename = $_FILES['Filedata']['name'];
     $parts = pathinfo($origFilename);
     $extension = "flv";
     // always flv ! //strtolower($parts['extension']);
     $extra_id = null;
     $file_alias = $token . '_' . $filename;
     // add the file extension after the "." character
     $fullPath = myContentStorage::getFSContentRootPath() . "content/webcam/my_recorded_stream_" . $file_alias . ($extra_id ? "_" . $extra_id : "") . "." . $extension;
     myContentStorage::fullMkdir($fullPath);
     move_uploaded_file($_FILES['Filedata']['tmp_name'], $fullPath);
     chmod($fullPath, 0777);
     $res = array("token" => $token, "filename" => $filename, "origFilename" => $origFilename);
     // should upload the file with the token as the prefix
     $this->addMsg("result_ok", $res);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:webcamdummyAction.class.php

示例3: executeImpl

 /**
  * Executes index action
  */
 protected function executeImpl(kshow $kshow)
 {
     $this->xml_content = "";
     $kshow_id = $this->kshow_id;
     if ($kshow_id == NULL || $kshow_id == 0) {
         return sfView::SUCCESS;
     }
     $metadata_creator = new myKshowMetadataCreator();
     $this->show_metadata = $metadata_creator->createMetadata($kshow_id);
     //		$kshow = kshowPeer:retrieveByPK( $kshow_id );
     $entry = entryPeer::retrieveByPK($kshow->getShowEntryId());
     // TODO - this should never happen
     if ($entry == NULL) {
         // there is no show entry for this show !
         $entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId());
     }
     $content_path = myContentStorage::getFSContentRootPath();
     $file_path = $content_path . $entry->getDataPath();
     // check to see if the content of the file changed
     $current_metadata = kFile::getFileContent($file_path);
     $comp_result = strcmp($this->show_metadata, $current_metadata);
     if ($comp_result != 0) {
         $ext = pathinfo($file_path, PATHINFO_EXTENSION);
         if ($ext != "xml") {
             // this is for the first time - override the template path by setting the data to NULL
             $entry->setData(NULL);
             $file_path = pathinfo($file_path, PATHINFO_DIRNAME) . "/" . kFile::getFileNameNoExtension($file_path) . ".xml";
         }
         // this will increment the name if needed
         $entry->setData($file_path);
         $file_path = $content_path . $entry->getDataPath();
         $entry->save();
         myContentStorage::fullMkdir($file_path);
         kFile::setFileContent($file_path, $this->show_metadata);
         $this->xml_content = $this->show_metadata;
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:40,代码来源:createDefaultMetadataAction.class.php

示例4: createTeam2Image

 public static function createTeam2Image($kshow_id)
 {
     try {
         $kshow = kshowPeer::retrieveByPK($kshow_id);
         if (!$kshow) {
             return NULL;
         }
         $contentPath = myContentStorage::getFSContentRootPath();
         // TODO - maybe start from some kaltura background - so if image is not full - still interesting
         $im = imagecreatetruecolor(24 * 7 - 1, 24 * 2 - 1);
         $logo_path = kFile::fixPath(SF_ROOT_DIR . '/web/images/browse/contributorsBG.gif');
         $im = imagecreatefromgif($logo_path);
         // fetch as many different kusers as possible who contributed to the kshow
         // first entries will come up first
         $c = new Criteria();
         $c->add(entryPeer::KSHOW_ID, $kshow_id);
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP, Criteria::EQUAL);
         //$c->add ( entryPeer::PICTURE, null, Criteria::NOT_EQUAL );
         $c->setLimit(14);
         // we'll need 14 images of contributers
         $c->addGroupByColumn(entryPeer::KUSER_ID);
         $c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
         $entries = baseentryPeer::doSelectJoinkuser($c);
         if ($entries == NULL || count($entries) == 0) {
             imagedestroy($im);
             return;
         }
         $entry_list_len = count($entries);
         reset($entries);
         if ($entry_list_len > 0) {
             for ($y = 0; $y <= 1; ++$y) {
                 for ($x = 0; $x <= 6; ++$x) {
                     self::addKuserPictureFromEntry($contentPath, $im, $entries, $x, $y, 1, 24, 24);
                 }
             }
         } else {
             // no contributers - need to create some other image
         }
         $path = kFile::fixPath($contentPath . $kshow->getTeam2PicturePath());
         myContentStorage::fullMkdir($path);
         imagepng($im, $path);
         imagedestroy($im);
         $kshow->setHasTeamImage(true);
         $kshow->save();
     } catch (Exception $ex) {
         // nothing much we can do here !
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:48,代码来源:myKshowUtils.class.php

示例5: myBatchFlattenServer

 public function myBatchFlattenServer($script_name)
 {
     $this->script_name = $script_name;
     $this->register($script_name);
     SET_CONTEXT("FS");
     $MAX_ITERATIONS_DUE_TO_PROPEL_MEMORY_LEAK = 10000000;
     self::initDb();
     list($sleep_between_cycles, $number_of_times_to_skip_writing_sleeping) = self::getSleepParams('app_flatten_');
     $last_worker_count = 0;
     $iteration = 0;
     $c = new Criteria();
     $currentDc = kDataCenterMgr::getCurrentDc();
     $c->add(BatchJobPeer::DC, kDataCenterMgr::getCurrentDcId());
     $c->add(BatchJobPeer::JOB_TYPE, BatchJobType::FLATTEN);
     $c->add(BatchJobPeer::STATUS, BatchJob::BATCHJOB_STATUS_PROCESSED);
     $temp_count = 0;
     while (1) {
         self::exitIfDone();
         try {
             sleep($sleep_between_cycles);
             $jobs = BatchJobPeer::doSelect($c);
             foreach ($jobs as $job) {
                 $data = json_decode($job->getData(true), true);
                 $entry_id = $data['entryId'];
                 $entry_int_id = $data['entryIntId'];
                 $entry_version = $data['entryVersion'];
                 $file_format = $data['fileFormat'];
                 $entry = entryPeer::retrieveByPK($entry_id);
                 if (!$entry) {
                     // entry is probably deleted if it is not returned from retrieveByPK
                     // close job as failed
                     $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                     $job->setDescription("could not retrieve entry, probably deleted");
                     TRACE("could not retrieve entry {$entry_id} , probably deleted");
                     $job->save();
                     continue;
                 }
                 $fileSyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DOWNLOAD, $file_format);
                 $fullFinalPath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey);
                 $finalPathNoExt = substr($fullFinalPath, 0, strlen($fullFinalPath) - strlen($file_format));
                 myContentStorage::fullMkdir($fullFinalPath);
                 $wildcardFinalPath = $finalPathNoExt . "*";
                 $older_files = glob($wildcardFinalPath);
                 foreach ($older_files as $older_file) {
                     TRACE("removing old file: [{$older_file}]");
                     @unlink($older_file);
                 }
                 TRACE("Downloading: {$fullFinalPath}");
                 kFile::downloadUrlToFile($data["serverUrl"], $fullFinalPath);
                 if (!file_exists($fullFinalPath)) {
                     TRACE("file doesnt exist: " . $data["serverUrl"]);
                     $job->setDescription("file doesnt exist: " . $data["serverUrl"]);
                     $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                 } else {
                     if (filesize($fullFinalPath) < 100000) {
                         @unlink($fullFinalPath);
                         TRACE("file too small: " . $data["serverUrl"]);
                         $job->setDescription("file too small: " . $data["serverUrl"]);
                         $job->setStatus(BatchJob::BATCHJOB_STATUS_FAILED);
                     } else {
                         if ($data['email']) {
                             $downloadLink = $entry->getDownloadUrl() . '/format/' . $file_format;
                             kJobsManager::addMailJob(null, $entry_id, $entry->getPartnerId(), self::KALTURAS_FLATTEN_READY, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("batch_flatten_video_sender_email"), kConf::get("batch_flatten_video_sender_name"), $data['email'], array($data['email'], $downloadLink));
                         }
                         TRACE("Deleting: " . $data["deleteUrl"]);
                         kFile::downloadUrlToString($data["deleteUrl"]);
                         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry);
                         $job->setStatus(BatchJob::BATCHJOB_STATUS_FINISHED);
                         $filePath = kFileSyncUtils::getLocalFilePathForKey($fileSyncKey);
                         if (file_exists($filePath)) {
                             try {
                                 kFileSyncUtils::createSyncFileForKey($fileSyncKey);
                             } catch (Exception $ex) {
                                 TRACE("ignore ERROR: " . $ex->getMessage());
                             }
                         } else {
                             TRACE("The file [{$filePath}] doesn't exists, not creating FileSync");
                         }
                     }
                 }
                 $job->save();
             }
         } catch (Exception $ex) {
             TRACE("ERROR: " . $ex->getMessage());
             self::initDb(true);
             self::failed();
         }
         if ($temp_count == 0) {
             TRACE("Ended conversion. sleeping for a while (" . $sleep_between_cycles . " seconds). Will write to the log in (" . $sleep_between_cycles * $number_of_times_to_skip_writing_sleeping . ") seconds");
         }
         $temp_count++;
         if ($temp_count >= $number_of_times_to_skip_writing_sleeping) {
             $temp_count = 0;
         }
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:96,代码来源:myBatchFlattenVideo.class.php

示例6: moveFile

 public static function moveFile($from, $to, $override_if_exists = false, $copy = false)
 {
     $from = str_replace("\\", "/", $from);
     $to = str_replace("\\", "/", $to);
     if ($override_if_exists && is_file($to)) {
         self::deleteFile($to);
     }
     if (!is_dir(dirname($to))) {
         myContentStorage::fullMkdir($to);
     }
     KalturaLog::log("myContentStorage::moveFile ({$copy}): {$from} to {$to}");
     if (file_exists($from)) {
         KalturaLog::log(__METHOD__ . " - {$from} file exists");
     } else {
         KalturaLog::log(__METHOD__ . " - {$from} file doesnt exist");
     }
     if ($copy) {
         return copy($from, $to);
     } else {
         return rename($from, $to);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:22,代码来源:myContentStorage.class.php

示例7: createWidgetImage

 public static function createWidgetImage($entry, $create)
 {
     $contentPath = myContentStorage::getFSContentRootPath();
     $path = kFile::fixPath($contentPath . $entry->getWidgetImagePath());
     // if the create flag is not set and the file doesnt exist exit
     // e.g. the roughcut name has change, we update the image only if it was already in some widget
     if (!$create && !file_exists($path)) {
         return;
     }
     $im = imagecreatetruecolor(400, 30);
     $color = imagecolorallocate($im, 188, 230, 99);
     $font = SF_ROOT_DIR . '/web/ttf/arial.ttf';
     imagettftext($im, 12, 0, 10, 21, $color, $font, $entry->getName());
     myContentStorage::fullMkdir($path);
     imagegif($im, $path);
     imagedestroy($im);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:17,代码来源:myEntryUtils.class.php

示例8: createWidgetImage

 public static function createWidgetImage($partner, $create)
 {
     $contentPath = myContentStorage::getFSContentRootPath();
     $path = kFile::fixPath($contentPath . $partner->getWidgetImagePath());
     // if the create flag is not set and the file doesnt exist exit
     // e.g. the roughcut name has change, we update the image only if it was already in some widget
     if (!$create && !file_exists($path)) {
         return;
     }
     $im = imagecreatetruecolor(400, 20);
     $green = imagecolorallocate($im, 188, 230, 99);
     $white = imagecolorallocate($im, 255, 255, 255);
     $font = SF_ROOT_DIR . '/web/ttf/arial.ttf';
     $fontSize = 9;
     $bottom = 15;
     $pos = imagettftext($im, $fontSize, 0, 10, $bottom, $green, $font, $partner->getPartnerName() . " Collaborative Video");
     $pos = imagettftext($im, $fontSize, 0, $pos[2], $bottom, $white, $font, " powered by ");
     imagettftext($im, $fontSize, 0, $pos[2], $bottom, $green, $font, "Kaltura");
     myContentStorage::fullMkdir($path);
     imagegif($im, $path);
     imagedestroy($im);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:22,代码来源:myPartnerUtils.class.php

示例9: handleMoveFile

 /**
  * Move the uploaded file
  * @param unknown_type $fileData
  */
 protected function handleMoveFile($fileData)
 {
     KalturaLog::info("Moving the uploaded file");
     // get the upload path
     $extension = strtolower(pathinfo($fileData['name'], PATHINFO_EXTENSION));
     $uploadFilePath = $this->getUploadPath($this->_uploadToken->getId(), $extension);
     $this->_uploadToken->setUploadTempPath($uploadFilePath);
     myContentStorage::fullMkdir($uploadFilePath);
     $moveFileSuccess = move_uploaded_file($fileData['tmp_name'], $uploadFilePath);
     if (!$moveFileSuccess) {
         $msg = "Failed to move uploaded file for token id [{$this->_uploadToken->getId()}]";
         KalturaLog::log($msg . ' ' . print_r($fileData, true));
         throw new kUploadTokenException($msg, kUploadTokenException::UPLOAD_TOKEN_FAILED_TO_MOVE_UPLOADED_FILE);
     } else {
         KalturaLog::info("The file was moved successfully");
     }
     chmod($uploadFilePath, 0777);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:kUploadTokenMgr.php


注:本文中的myContentStorage::fullMkdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。