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


PHP Dba::optimize_tables方法代码示例

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


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

示例1: process_action

 public static function process_action($action, $catalogs, $options = null)
 {
     if (!$options || !is_array($options)) {
         $options = array();
     }
     switch ($action) {
         case 'add_to_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'add_to_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog($options);
                     }
                 }
                 if (!defined('SSE_OUTPUT')) {
                     AmpError::display('catalog_add');
                 }
             }
             break;
         case 'update_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'update_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->verify_catalog();
                     }
                 }
             }
             break;
         case 'full_service':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             /* This runs the clean/verify/add in that order */
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     $catalog->clean_catalog();
                     $catalog->verify_catalog();
                     $catalog->add_to_catalog();
                 }
             }
             Dba::optimize_tables();
             break;
         case 'clean_all_catalogs':
             $catalogs = Catalog::get_catalogs();
         case 'clean_catalog':
             if ($catalogs) {
                 foreach ($catalogs as $catalog_id) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->clean_catalog();
                     }
                 }
                 // end foreach catalogs
                 Dba::optimize_tables();
             }
             break;
         case 'update_from':
             $catalog_id = 0;
             // First see if we need to do an add
             if ($options['add_path'] != '/' && strlen($options['add_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['add_path'])) {
                     $catalog = Catalog::create_from_id($catalog_id);
                     if ($catalog !== null) {
                         $catalog->add_to_catalog(array('subdirectory' => $options['add_path']));
                     }
                 }
             }
             // end if add
             // Now check for an update
             if ($options['update_path'] != '/' && strlen($options['update_path'])) {
                 if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
                     $songs = Song::get_from_path($options['update_path']);
                     foreach ($songs as $song_id) {
                         Catalog::update_single_item('song', $song_id);
                     }
                 }
             }
             // end if update
             if ($catalog_id <= 0) {
                 AmpError::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
             }
             break;
         case 'gather_media_art':
             if (!$catalogs) {
                 $catalogs = Catalog::get_catalogs();
             }
             // Iterate throught the catalogs and gather as needed
             foreach ($catalogs as $catalog_id) {
                 $catalog = Catalog::create_from_id($catalog_id);
                 if ($catalog !== null) {
                     require AmpConfig::get('prefix') . UI::find_template('show_gather_art.inc.php');
                     flush();
                     $catalog->gather_art();
                 }
//.........这里部分代码省略.........
开发者ID:bl00m,项目名称:ampache,代码行数:101,代码来源:catalog.class.php

示例2: foreach

     }
     Dba::optimize_tables();
     break;
 case 'clean_all_catalogs':
     $_REQUEST['catalogs'] = Catalog::get_catalogs();
 case 'clean_catalog':
     // Make sure they checked something
     if (isset($_REQUEST['catalogs'])) {
         foreach ($_REQUEST['catalogs'] as $catalog_id) {
             $catalog = Catalog::create_from_id($catalog_id);
             if ($catalog !== null) {
                 $catalog->clean_catalog();
             }
         }
         // end foreach catalogs
         Dba::optimize_tables();
     }
     break;
 case 'update_from':
     $catalog_id = 0;
     // First see if we need to do an add
     if ($_REQUEST['add_path'] != '/' and strlen($_REQUEST['add_path'])) {
         if ($catalog_id = Catalog_local::get_from_path($_REQUEST['add_path'])) {
             $catalog = Catalog::create_from_id($catalog_id);
             if ($catalog !== null) {
                 $catalog->add_to_catalog(array('subdirectory' => $_REQUEST['add_path']));
             }
         }
     }
     // end if add
     // Now check for an update
开发者ID:nioc,项目名称:ampache,代码行数:31,代码来源:sse.server.php


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