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


PHP kFile::closeDbConnections方法代码示例

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


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

示例1: writeBulkUploadLogFile

 /**
  * Returns the log file for bulk upload job
  * @param BatchJob $batchJob bulk upload batchjob
  */
 public static function writeBulkUploadLogFile($batchJob)
 {
     if ($batchJob->getJobSubType() != self::getBulkUploadTypeCoreValue(BulkUploadXmlType::XML)) {
         return;
     }
     $xmlElement = self::getBulkUploadMrssXml($batchJob);
     if (is_null($xmlElement)) {
         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><mrss><error>Log file is not ready: " . $batchJob->getMessage() . "</error></mrss>";
         kFile::closeDbConnections();
         exit;
     }
     echo $xmlElement->asXML();
     kFile::closeDbConnections();
     exit;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:19,代码来源:BulkUploadXmlPlugin.php

示例2: serveBulkAction

 /**
  * Download multiple cue points objects as XML definitions
  * 
  * @action serveBulk
  * @param KalturaCuePointFilter $filter
  * @param KalturaFilterPager $pager
  * @return file
  */
 function serveBulkAction(KalturaCuePointFilter $filter = null, KalturaFilterPager $pager = null)
 {
     if (!$filter) {
         $filter = new KalturaCuePointFilter();
     }
     $c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
     if ($this->getCuePointType()) {
         $c->add(CuePointPeer::TYPE, $this->getCuePointType());
     }
     $cuePointFilter = $filter->toObject();
     $cuePointFilter->attachToCriteria($c);
     if ($pager) {
         $pager->attachToCriteria($c);
     }
     $list = CuePointPeer::doSelect($c);
     $xml = kCuePointManager::generateXml($list);
     header("Content-Type: text/xml; charset=UTF-8");
     echo $xml;
     kFile::closeDbConnections();
     exit(0);
 }
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:CuePointService.php

示例3: resizeEntryImage


//.........这里部分代码省略.........
                 $processing = $cache->get($orig_image_path);
                 if ($processing) {
                     KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
                 }
                 $cache->put($orig_image_path, true);
                 $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), flavorParams::TAG_THUMBSOURCE);
                 if (is_null($flavorAsset)) {
                     $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($entry->getId());
                     if ($flavorAsset) {
                         $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                         list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($flavorSyncKey, false, false);
                         if (!$fileSync) {
                             $flavorAsset = null;
                         }
                     }
                     if (is_null($flavorAsset) || !($flavorAsset->hasTag(flavorParams::TAG_MBR) || $flavorAsset->hasTag(flavorParams::TAG_WEB))) {
                         // try the best playable
                         $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), null, flavorParams::TAG_SAVE_SOURCE);
                     }
                     if (is_null($flavorAsset)) {
                         // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                         $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                     }
                 }
                 if (is_null($flavorAsset)) {
                     // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                 }
                 if (is_null($flavorAsset)) {
                     KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
                 }
                 $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $entry_data_path = kFileSyncUtils::getReadyLocalFilePathForKey($flavorSyncKey);
                 if (!$entry_data_path) {
                     // since this is not really being processed on this server, and will probably cause redirect in thumbnailAction
                     // remove from cache so later requests will still get redirected and will not fail on PROCESSING_CAPTURE_THUMBNAIL
                     $cache->remove($orig_image_path);
                     throw new kFileSyncException('no ready filesync on current DC', kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC);
                 }
                 // close db connections as we won't be requiring the database anymore and capturing a thumbnail may take a long time
                 kFile::closeDbConnections();
                 myFileConverter::autoCaptureFrame($entry_data_path, $capturedThumbPath . "temp_", $calc_vid_sec, -1, -1);
                 $cache->remove($orig_image_path);
             }
         }
         // close db connections as we won't be requiring the database anymore and image manipulation may take a long time
         kFile::closeDbConnections();
         // limit creation of more than XX Imagemagick processes
         if (kConf::hasParam("resize_thumb_max_processes_imagemagick") && trim(exec("ps -e -ocmd|awk '{print \$1}'|grep -c " . kConf::get("bin_path_imagemagick"))) > kConf::get("resize_thumb_max_processes_imagemagick")) {
             KExternalErrors::dieError(KExternalErrors::TOO_MANY_PROCESSES);
         }
         // resizing (and editing)) an image file that failes results in a long server waiting time
         // prevent this waiting time (of future requests) in case the resizeing failes
         $cache = new myCache("thumb-processing-resize", 5 * 60);
         // 5 minutes
         $processing = $cache->get($orig_image_path);
         if ($processing) {
             KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
         }
         kFile::fullMkdir($processingThumbPath);
         if ($crop_provider) {
             $convertedImagePath = myFileConverter::convertImageUsingCropProvider($orig_image_path, $processingThumbPath, $width, $height, $type, $crop_provider, $bgcolor, true, $quality, $src_x, $src_y, $src_w, $src_h, $density, $stripProfiles);
         } else {
             if (!file_exists($orig_image_path) || !filesize($orig_image_path)) {
                 KExternalErrors::dieError(KExternalErrors::IMAGE_RESIZE_FAILED);
             }
             $imageSizeArray = getimagesize($orig_image_path);
             if ($thumbParams->getSupportAnimatedThumbnail() && is_array($imageSizeArray) && $imageSizeArray[2] === IMAGETYPE_GIF) {
                 $processingThumbPath = kFile::replaceExt($processingThumbPath, "gif");
                 $finalThumbPath = kFile::replaceExt($finalThumbPath, "gif");
             }
             $convertedImagePath = myFileConverter::convertImage($orig_image_path, $processingThumbPath, $width, $height, $type, $bgcolor, true, $quality, $src_x, $src_y, $src_w, $src_h, $density, $stripProfiles, $thumbParams, $format);
         }
         // die if resize operation failed and add failed resizing to cache
         if ($convertedImagePath === null || !@filesize($convertedImagePath)) {
             $cache->put($orig_image_path, true);
             KExternalErrors::dieError(KExternalErrors::IMAGE_RESIZE_FAILED);
         }
         // if resizing secceded remove from cache of failed resizing
         if ($cache->get($orig_image_path)) {
             $cache->remove($orig_image_path, true);
         }
         if ($multi) {
             list($w, $h, $type, $attr, $srcIm) = myFileConverter::createImageByFile($processingThumbPath);
             if (!$im) {
                 $im = imagecreatetruecolor($w * $vid_slices, $h);
             }
             imagecopy($im, $srcIm, $w * $vid_slice, 0, 0, 0, $w, $h);
             imagedestroy($srcIm);
             ++$vid_slice;
         }
     }
     if ($multi) {
         imagejpeg($im, $processingThumbPath);
         imagedestroy($im);
     }
     kFile::fullMkdir($finalThumbPath);
     kFile::moveFile($processingThumbPath, $finalThumbPath);
     return $finalThumbPath;
 }
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例4: writeBulkUploadLogFile

 /**
  * Returns the log file for bulk upload job
  * @param BatchJob $batchJob bulk upload batchjob
  */
 public static function writeBulkUploadLogFile($batchJob)
 {
     if ($batchJob->getJobSubType() && $batchJob->getJobSubType() != self::getBulkUploadTypeCoreValue(BulkUploadCsvType::CSV)) {
         return;
     }
     header("Content-Type: text/plain; charset=UTF-8");
     $criteria = new Criteria();
     $criteria->add(BulkUploadResultPeer::BULK_UPLOAD_JOB_ID, $batchJob->getId());
     $criteria->addAscendingOrderByColumn(BulkUploadResultPeer::LINE_INDEX);
     $criteria->setLimit(100);
     $bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
     if (!count($bulkUploadResults)) {
         die("Log file is not ready");
     }
     $STDOUT = fopen('php://output', 'w');
     $data = $batchJob->getData();
     /* @var $data kBulkUploadJobData */
     //Add header row to the output CSV only if partner level permission for it exists
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     if (PermissionPeer::isValidForPartner(self::FEATURE_CSV_HEADER_ROW, $partnerId)) {
         $headerRow = $data->getColumns();
         $headerRow[] = "resultStatus";
         $headerRow[] = "objectId";
         $headerRow[] = "objectStatus";
         $headerRow[] = "errorDescription";
         fputcsv($STDOUT, $headerRow);
     }
     $handledResults = 0;
     while (count($bulkUploadResults)) {
         $handledResults += count($bulkUploadResults);
         foreach ($bulkUploadResults as $bulkUploadResult) {
             /* @var $bulkUploadResult BulkUploadResult */
             $values = str_getcsv($bulkUploadResult->getRowData());
             //		    switch ($bulkUploadResult->getObjectType())
             //		    {
             //		        case BulkUploadObjectType::ENTRY:
             //		            $values = self::writeEntryBulkUploadResults($bulkUploadResult, $data);
             //		            break;
             //		        case BulkUploadObjectType::CATEGORY:
             //		            $values = self::writeCategoryBulkUploadResults($bulkUploadResult, $data);
             //		            break;
             //		        case BulkUploadObjectType::CATEGORY_USER:
             //		            $values = self::writeCategoryUserBulkUploadResults($bulkUploadResult, $data);
             //		            break;
             //		        case BulkUploadObjectType::USER:
             //		            $values = self::writeUserBulkUploadResults($bulkUploadResult, $data);
             //		            break;
             //		        default:
             //
             //		            break;
             //		    }
             $values[] = $bulkUploadResult->getStatus();
             $values[] = $bulkUploadResult->getObjectId();
             $values[] = $bulkUploadResult->getObjectStatus();
             $values[] = preg_replace('/[\\n\\r\\t]/', ' ', $bulkUploadResult->getErrorDescription());
             fputcsv($STDOUT, $values);
         }
         if (count($bulkUploadResults) < $criteria->getLimit()) {
             break;
         }
         kMemoryManager::clearMemory();
         $criteria->setOffset($handledResults);
         $bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
     }
     fclose($STDOUT);
     kFile::closeDbConnections();
     exit;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:72,代码来源:BulkUploadCsvPlugin.php

示例5: writeBulkUploadLogFile

 /**
  * Returns the log file for bulk upload job
  * @param BatchJob $batchJob bulk upload batchjob
  * @param bool $addHeaderRow flag signifying whether the header row should be added to the CSV. Default value is false.
  */
 public static function writeBulkUploadLogFile($batchJob, $addHeaderRow = false)
 {
     if ($batchJob->getJobSubType() != null && $batchJob->getJobSubType() != self::getBulkUploadTypeCoreValue(BulkUploadCsvType::CSV)) {
         return;
     }
     header("Content-Type: text/plain; charset=UTF-8");
     $bulkUploadResults = BulkUploadResultPeer::retrieveByBulkUploadId($batchJob->getId());
     if (!count($bulkUploadResults)) {
         die("Log file is not ready");
     }
     $STDOUT = fopen('php://output', 'w');
     $data = $batchJob->getData();
     /* @var $data kBulkUploadJobData */
     //Add header row to the output CSV
     if ($addHeaderRow) {
         $headerRow = self::getHeaderRow($data->getBulkUploadObjectType());
         $headerRow[] = "action";
         $headerRow[] = "resultStatus";
         $headerRow[] = "objectId";
         $headerRow[] = "objectStatus";
         $headerRow[] = "errorDescription";
         fputcsv($STDOUT, $headerRow);
     }
     foreach ($bulkUploadResults as $bulkUploadResult) {
         /* @var $bulkUploadResult BulkUploadResult */
         switch ($bulkUploadResult->getObjectType()) {
             case BulkUploadObjectType::ENTRY:
                 $values = self::writeEntryBulkUploadResults($bulkUploadResult, $data);
                 break;
             case BulkUploadObjectType::CATEGORY:
                 $values = self::writeCategoryBulkUploadResults($bulkUploadResult, $data);
                 break;
             case BulkUploadObjectType::CATEGORY_USER:
                 $values = self::writeCategoryUserBulkUploadResults($bulkUploadResult, $data);
                 break;
             case BulkUploadObjectType::USER:
                 $values = self::writeUserBulkUploadResults($bulkUploadResult, $data);
                 break;
             default:
                 break;
         }
         $values[] = $bulkUploadResult->getAction();
         $values[] = $bulkUploadResult->getStatus();
         $values[] = $bulkUploadResult->getObjectId();
         $values[] = $bulkUploadResult->getObjectStatus();
         $values[] = preg_replace('/[\\n\\r\\t]/', ' ', $bulkUploadResult->getErrorDescription());
         fputcsv($STDOUT, $values);
     }
     fclose($STDOUT);
     kFile::closeDbConnections();
     exit;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:BulkUploadCsvPlugin.php

示例6: writeBulkUploadLogFile

 /**
  * Returns the log file for bulk upload job
  * @param BatchJob $batchJob bulk upload batchjob
  */
 public static function writeBulkUploadLogFile($batchJob)
 {
     if ($batchJob->getJobSubType() && $batchJob->getJobSubType() != self::getBulkUploadTypeCoreValue(BulkUploadFilterType::FILTER)) {
         return;
     }
     //TODO:
     header("Content-Type: text/plain; charset=UTF-8");
     $criteria = new Criteria();
     $criteria->add(BulkUploadResultPeer::BULK_UPLOAD_JOB_ID, $batchJob->getId());
     $criteria->addAscendingOrderByColumn(BulkUploadResultPeer::LINE_INDEX);
     $criteria->setLimit(100);
     $bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
     if (!count($bulkUploadResults)) {
         die("Log file is not ready");
     }
     $STDOUT = fopen('php://output', 'w');
     $data = $batchJob->getData();
     /* @var $data kBulkUploadFilterJobData */
     $handledResults = 0;
     while (count($bulkUploadResults)) {
         $handledResults += count($bulkUploadResults);
         foreach ($bulkUploadResults as $bulkUploadResult) {
             $values = array();
             $values['bulkUploadResultStatus'] = $bulkUploadResult->getStatus();
             $values['objectId'] = $bulkUploadResult->getObjectId();
             $values['objectStatus'] = $bulkUploadResult->getObjectStatus();
             $values['errorDescription'] = preg_replace('/[\\n\\r\\t]/', ' ', $bulkUploadResult->getErrorDescription());
             fwrite($STDOUT, print_r($values, true));
         }
         if (count($bulkUploadResults) < $criteria->getLimit()) {
             break;
         }
         kMemoryManager::clearMemory();
         $criteria->setOffset($handledResults);
         $bulkUploadResults = BulkUploadResultPeer::doSelect($criteria);
     }
     fclose($STDOUT);
     kFile::closeDbConnections();
     exit;
 }
开发者ID:DBezemer,项目名称:server,代码行数:44,代码来源:BulkUploadFilterPlugin.php


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