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


PHP Requirements::updateRequirementAndPackage方法代码示例

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


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

示例1: updateRequirementPackage

 public function updateRequirementPackage($pack)
 {
     if (!$pack || !$pack->game_id || !$pack->requirement_root_package_id) {
         return;
     }
     Module::query("UPDATE requirement_root_packages SET " . "game_id = '" . addslashes($pack->game_id) . "'" . ($pack->name ? ", name = '" . addslashes($pack->name) . "'" : "") . " WHERE requirement_root_package_id = '" . addslashes($pack->requirement_root_package_id) . "'");
     $sql_currentAndPacks = Module::queryArray("SELECT * FROM requirement_and_packages WHERE requirement_root_package_id = '{$pack->requirement_root_package_id}'");
     for ($i = 0; $i < count($sql_currentAndPacks); $i++) {
         $matchingAndPack = null;
         for ($j = 0; $pack->and_packages && $j < count($pack->and_packages); $j++) {
             if ($sql_currentAndPacks[$i]->requirement_and_package_id == $pack->and_packages[$j]->requirement_and_package_id) {
                 $matchingAndPack = $pack->and_packages[$j];
                 //remove from array so I can just add all remaining later
                 array_splice($pack->and_packages, $j, 1);
                 $j--;
             }
         }
         if ($matchingAndPack) {
             $matchingAndPack->requirement_root_package_id = $pack->requirement_root_package_id;
             $matchingAndPack->game_id = $pack->game_id;
             Requirements::updateRequirementAndPackage($matchingAndPack);
         } else {
             Requirements::deleteRequirementAndPackage($sql_currentAndPacks[$i]->requirement_and_package_id);
         }
     }
     for ($i = 0; $pack->and_packages && $i < count($pack->and_packages); $i++) {
         $pack->and_packages[$i]->requirement_root_package_id = $pack->requirement_root_package_id;
         $pack->and_packages[$i]->game_id = $pack->game_id;
         Requirements::createRequirementAndPackage($pack->and_packages[$i]);
     }
     return Requirements::getRequirementPackage($pack->requirement_root_package_id);
 }
开发者ID:kimblemj,项目名称:server,代码行数:32,代码来源:requirements.php


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