Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • PimPlugin
  • PimPluginArchiveExtractor
  • PimPluginCollection
  • PimPluginRelations
  • PimPluginRelationsCollection
  • PimPluginSetup
  • PimPluginSetupInstall
  • PimPluginSetupStatus
  • PimPluginSetupUninstall
  • PimPluginSetupUpdate
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains abstract class for installation new plugins
  4:  *
  5:  * @package Plugin
  6:  * @subpackage PluginManager
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Frederic Schneider
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Install class for new plugins, extends PimPluginSetup
 20:  *
 21:  * @package Plugin
 22:  * @subpackage PluginManager
 23:  * @author frederic.schneider
 24:  */
 25: class PimPluginSetupInstall extends PimPluginSetup {
 26: 
 27:     // Initializing variables
 28:     // Plugin specific data
 29:     // Foldername of installed plugin
 30:     private $PluginFoldername;
 31: 
 32:     // All area entries from database in an array
 33:     private $PluginInstalledAreas = array();
 34: 
 35:     // Classes
 36:     // Class variable for PimPluginCollection
 37:     protected $_PimPluginCollection;
 38: 
 39:     // Class variable for PimPluginRelationsCollection
 40:     protected $_PimPluginRelationsCollection;
 41: 
 42:     // Class variable for cApiAreaCollection;
 43:     protected $_ApiAreaCollection;
 44: 
 45:     // Class variable for cApiActionCollection
 46:     protected $_ApiActionCollection;
 47: 
 48:     // Class variable for cApiFileCollection
 49:     protected $_ApiFileCollection;
 50: 
 51:     // Class variable for cApiFrameFileCollection
 52:     protected $_ApiFrameFileCollection;
 53: 
 54:     // Class variable for cApiNavMainCollection
 55:     protected $_ApiNavMainCollection;
 56: 
 57:     // Class variable for cApiNavSubCollection
 58:     protected $_ApiNavSubCollection;
 59: 
 60:     // Class variable for cApiTypeCollection
 61:     protected $_ApiTypeCollection;
 62: 
 63:     // GET and SET methods for installation routine
 64:     /**
 65:      * Set variable for plugin foldername
 66:      *
 67:      * @access public
 68:      * @param string $foldername
 69:      * @return string
 70:      */
 71:     private function _setPluginFoldername($foldername) {
 72:         return $this->PluginFoldername = cSecurity::escapeString($foldername);
 73:     }
 74: 
 75:     /**
 76:      * Initializing and set variable for PimPluginCollection class
 77:      *
 78:      * @access private
 79:      * @return PimPluginCollection
 80:      */
 81:     private function _setPimPluginCollection() {
 82:         return $this->_PimPluginCollection = new PimPluginCollection();
 83:     }
 84: 
 85:     /**
 86:      * Initializing and set variable for PimPluginRelationsCollection class
 87:      *
 88:      * @access private
 89:      * @return PimPluginRelationsCollection
 90:      */
 91:     private function _setPimPluginRelationsCollection() {
 92:         return $this->_PimPluginRelationsCollection = new PimPluginRelationsCollection();
 93:     }
 94: 
 95:     /**
 96:      * Initializing and set variable for cApiAreaCollection
 97:      *
 98:      * @access private
 99:      * @return cApiAreaCollection
100:      */
101:     private function _setApiAreaCollection() {
102:         return $this->_ApiAreaCollection = new cApiAreaCollection();
103:     }
104: 
105:     /**
106:      * Initializing and set variable for cApiActionCollection
107:      *
108:      * @access private
109:      * @return cApiActionCollection
110:      */
111:     private function _setApiActionCollection() {
112:         return $this->_ApiActionCollection = new cApiActionCollection();
113:     }
114: 
115:     /**
116:      * Initializing and set variable for cApiAFileCollection
117:      *
118:      * @access private
119:      * @return cApiFileCollection
120:      */
121:     private function _setApiFileCollection() {
122:         return $this->_ApiFileCollection = new cApiFileCollection();
123:     }
124: 
125:     /**
126:      * Initializing and set variable for cApiFrameFileCollection
127:      *
128:      * @access private
129:      * @return cApiFrameFileCollection
130:      */
131:     private function _setApiFrameFileCollection() {
132:         return $this->_ApiFrameFileCollection = new cApiFrameFileCollection();
133:     }
134: 
135:     /**
136:      * Initializing and set variable for cApiNavMainFileCollection
137:      *
138:      * @access private
139:      * @return cApiNavMainCollection
140:      */
141:     private function _setApiNavMainCollection() {
142:         return $this->_ApiNavMainCollection = new cApiNavMainCollection();
143:     }
144: 
145:     /**
146:      * Initializing and set variable for cApiNavSubCollection
147:      *
148:      * @access private
149:      * @return cApiNavSubCollection
150:      */
151:     private function _setApiNavSubCollection() {
152:         return $this->_ApiNavSubCollection = new cApiNavSubCollection();
153:     }
154: 
155:     /**
156:      * Initializing and set variable for cApiTypeCollection
157:      *
158:      * @access private
159:      * @return cApiNavSubCollection
160:      */
161:     private function _setApiTypeCollection() {
162:         return $this->_ApiTypeCollection = new cApiTypeCollection();
163:     }
164: 
165:     /**
166:      * Get method for foldername of installed plugin
167:      *
168:      * @return string
169:      */
170:     protected function _getPluginFoldername() {
171:         return $this->PluginFoldername;
172:     }
173: 
174:     /**
175:      * Get method for installed areas
176:      *
177:      * @return multitype:
178:      */
179:     protected function _getInstalledAreas() {
180:         return $this->PluginInstalledAreas;
181:     }
182: 
183:     // Begin of installation routine
184:     /**
185:      * Construct function
186:      *
187:      * @access public
188:      * @return void
189:      */
190:     public function __construct() {
191: 
192:         // Initializing and set classes
193:         // PluginManager classes
194:         $this->_setPimPluginCollection();
195:         $this->_setPimPluginRelationsCollection();
196: 
197:         // cApiClasses
198:         $this->_setApiAreaCollection();
199:         $this->_setApiActionCollection();
200:         $this->_setApiFileCollection();
201:         $this->_setApiFrameFileCollection();
202:         $this->_setApiNavMainCollection();
203:         $this->_setApiNavSubCollection();
204:         $this->_setApiTypeCollection();
205:     }
206: 
207:     /**
208:      * Installation method
209:      *
210:      * @access public
211:      * @return void
212:      */
213:     public function install() {
214: 
215:         // Does this plugin already exist?
216:         $this->_installCheckUuid();
217: 
218:         // Requirement checks
219:         $this->_installCheckRequirements();
220: 
221:         // Add new plugin: *_plugins
222:         $this->_installAddPlugin();
223: 
224:         // Get all area names from database
225:         $this->_installFillAreas();
226: 
227:         // Add new CONTENIDO areas: *_area
228:         $this->_installAddAreas();
229: 
230:         // Add new CONTENIDO actions: *_actions
231:         $this->_installAddActions();
232: 
233:         // Add new CONTENIDO frames: *_frame_files and *_files
234:         $this->_installAddFrames();
235: 
236:         // Add new CONTENIDO main navigations: *_nav_main
237:         $this->_installAddNavMain();
238: 
239:         // Add new CONTENIDO sub navigations: *_nav_sub
240:         $this->_installAddNavSub();
241: 
242:         // Add specific sql queries, run only if we have no update sql file
243:         if (PimPluginSetup::_getUpdateSqlFileExist() == false) {
244:             $this->_installAddSpecificSql();
245:         }
246: 
247:         // Add new CONTENIDO content types: *_type
248:         $this->_installAddContentTypes();
249: 
250:         // Add new modules
251:         $this->_installAddModules();
252: 
253:         // Add plugin dir for uploaded plugins
254:         if (parent::getMode() == 2) {
255:             $this->_installAddDir();
256:         }
257: 
258:         // Success message for new plugins
259:         // Get only for extracted (1) and installed mode (2)
260:         if (parent::getMode() <= 2) {
261:             parent::info(i18n('The plugin has been successfully installed. To apply the changes please login into backend again.', 'pim'));
262:         }
263:     }
264: 
265:     /**
266:      * Check uuId: You can install a plugin only for one time
267:      *
268:      * @access private
269:      * @return void
270:      */
271:     private function _installCheckUuid() {
272:         $this->_PimPluginCollection->setWhere('uuid', parent::$XmlGeneral->uuid);
273:         $this->_PimPluginCollection->query();
274:         if ($this->_PimPluginCollection->count() > 0) {
275:             parent::error(i18n('You can install this plugin only for one time.', 'pim'));
276:         }
277:     }
278: 
279:     /**
280:      * This function checks requirements for one plugin
281:      *
282:      * @access private
283:      * @return void
284:      */
285:     private function _installCheckRequirements() {
286: 
287:         // Get config variables
288:         $cfg = cRegistry::getConfig();
289: 
290:         // Check min CONTENIDO version
291:         if (version_compare(CON_VERSION, parent::$XmlRequirements->contenido->attributes()->minversion, '<')) {
292:             parent::error(i18n('You have to install CONTENIDO <strong>', 'pim') . parent::$XmlRequirements->contenido->attributes()->minversion . i18n('</strong> or higher to install this plugin!', 'pim'));
293:         }
294: 
295:         // Check max CONTENIDO version
296:         if (parent::$XmlRequirements->contenido->attributes()->maxversion) {
297: 
298:             if (version_compare(CON_VERSION, parent::$XmlRequirements->contenido->attributes()->maxversion, '>')) {
299:                 parent::error(i18n('Your current CONTENIDO version is to new - max CONTENIDO version: ' . parent::$XmlRequirements->contenido->attributes()->maxversion . '', 'pim'));
300:             }
301:         }
302: 
303:         // Check PHP version
304:         if (version_compare(phpversion(), parent::$XmlRequirements->attributes()->php, '<')) {
305:             parent::error(i18n('You have to install PHP <strong>', 'pim') . parent::$XmlRequirements->attributes()->php . i18n('</strong> or higher to install this plugin!', 'pim'));
306:         }
307: 
308:         // Check extensions
309:         if (count(parent::$XmlRequirements->extension) != 0) {
310: 
311:             for ($i = 0; $i < count(parent::$XmlRequirements->extension); $i++) {
312: 
313:                 if (!extension_loaded(parent::$XmlRequirements->extension[$i]->attributes()->name)) {
314:                     parent::error(i18n('The plugin could not find the PHP extension <strong>', 'pim') . parent::$XmlRequirements->extension[$i]->attributes()->name . i18n('</strong>. Because this is required by the plugin, it can not be installed.', 'pim'));
315:                 }
316:             }
317:         }
318: 
319:         // Check classes
320:         if (count(parent::$XmlRequirements->class) != 0) {
321: 
322:             for ($i = 0; $i < count(parent::$XmlRequirements->class); $i++) {
323: 
324:                 if (!class_exists(parent::$XmlRequirements->class[$i]->attributes()->name)) {
325:                     parent::error(i18n('The plugin could not find the class <strong>', 'pim') . parent::$XmlRequirements->class[$i]->attributes()->name . i18n('</strong>. Because this is required by the plugin, it can not be installed.', 'pim'));
326:                 }
327:             }
328:         }
329: 
330:         // Check functions
331:         if (count(parent::$XmlRequirements->function) != 0) {
332: 
333:             for ($i = 0; $i < count(parent::$XmlRequirements->function); $i++) {
334: 
335:                 if (!function_exists(parent::$XmlRequirements->function[$i]->attributes()->name)) {
336:                     parent::error(i18n('The plugin could not find the function <strong>', 'pim') . parent::$XmlRequirements->function[$i]->attributes()->name . i18n('</strong>. Because this is required by the plugin, it can not be installed.', 'pim'));
337:                 }
338:             }
339:         }
340:     }
341: 
342:     /**
343:      * Add entries at *_plugins
344:      *
345:      * @access private
346:      * @return void
347:      */
348:     private function _installAddPlugin() {
349:         // Add entry at *_plugins
350:         $pimPlugin = $this->_PimPluginCollection->create(parent::$XmlGeneral->plugin_name, parent::$XmlGeneral->description, parent::$XmlGeneral->author, parent::$XmlGeneral->copyright, parent::$XmlGeneral->mail, parent::$XmlGeneral->website, parent::$XmlGeneral->version, parent::$XmlGeneral->plugin_foldername, parent::$XmlGeneral->uuid, parent::$XmlGeneral->attributes()->active);
351: 
352:         // Get Id of new plugin
353:         $pluginId = $pimPlugin->get('idplugin');
354: 
355:         // Set pluginId
356:         parent::setPluginId($pluginId);
357: 
358:         // Set foldername of new plugin
359:         $this->_setPluginFoldername(parent::$XmlGeneral->plugin_foldername);
360:     }
361: 
362:     /**
363:      * Get all area names from database
364:      *
365:      * @access private
366:      * @return void
367:      */
368:     private function _installFillAreas() {
369:         $oItem = $this->_ApiAreaCollection;
370:         $this->_ApiAreaCollection->select(NULL, NULL, 'name');
371:         while (($areas = $this->_ApiAreaCollection->next()) !== false) {
372:             $this->PluginInstalledAreas[] = $areas->get('name');
373:         }
374:     }
375: 
376:     /**
377:      * Add entries at *_area
378:      *
379:      * @access private
380:      * @return void
381:      */
382:     private function _installAddAreas() {
383: 
384:         // Initializing attribute array
385:         $attributes = array();
386: 
387:         // Get Id of plugin
388:         $pluginId = parent::_getPluginId();
389: 
390:         $areaCount = count(parent::$XmlArea->area);
391:         for ($i = 0; $i < $areaCount; $i++) {
392: 
393:             $attributes = array();
394: 
395:             // Build attributes
396:             foreach (parent::$XmlArea->area[$i]->attributes() as $key => $value) {
397:                 $attributes[$key] = $value;
398:             }
399: 
400:             // Security check
401:             $area = cSecurity::escapeString(parent::$XmlArea->area[$i]);
402: 
403:             // Add attributes "parent" and "menuless" to an array
404:             $attributes = array(
405:                 'parent' => cSecurity::escapeString($attributes['parent']),
406:                 'menuless' => cSecurity::toInteger($attributes['menuless'])
407:             );
408: 
409:             // Fix for parent attribute
410:             if (empty($attributes['parent'])) {
411:                 $attributes['parent'] = 0;
412:             }
413: 
414:             // Create a new entry
415:             $item = $this->_ApiAreaCollection->create($area, $attributes['parent'], 1, 1, $attributes['menuless']);
416: 
417:             // Set a relation
418:             $this->_PimPluginRelationsCollection->create($item->get('idarea'), $pluginId, 'area');
419: 
420:             // Add new area to all area array
421:             $this->PluginInstalledAreas[] = $area;
422:         }
423:     }
424: 
425:     /**
426:      * Add entries at *_actions
427:      *
428:      * @access private
429:      * @return void
430:      */
431:     private function _installAddActions() {
432:         $actionCount = count(parent::$XmlActions->action);
433:         for ($i = 0; $i < $actionCount; $i++) {
434: 
435:             $attributes = array();
436: 
437:             // Build attributes
438:             foreach (parent::$XmlActions->action[$i]->attributes() as $key => $value) {
439:                 $attributes[$key] = $value;
440:             }
441: 
442:             // Set relevant value if it is empty
443:             if (empty($attributes['relevant'])) {
444:                 $attributes['relevant'] = 1;
445:             }
446: 
447:             // Add attributes "area" and "relevant" to an safe array
448:             $attributes = array(
449:                 'area' => cSecurity::escapeString($attributes['area']),
450:                 'relevant' => cSecurity::toInteger($attributes['relevant'])
451:             );
452: 
453:             // Security check for action name
454:             $action = cSecurity::escapeString(parent::$XmlActions->action[$i]);
455: 
456:             // Check for valid area
457:             if (!in_array($attributes['area'], $this->_getInstalledAreas())) {
458:                 parent::error(i18n('Defined area', 'pim') . ' <strong>' . $attributes['area'] . '</strong> ' . i18n('are not found on your CONTENIDO installation. Please contact your plugin author.', 'pim'));
459:             }
460: 
461:             // Create a new entry
462:             $this->_ApiActionCollection->create($attributes['area'], $action, '', '', '', $attributes['relevant']);
463:         }
464:     }
465: 
466:     /**
467:      * Add entries at *_frame_files and *_files
468:      *
469:      * @access private
470:      * @return void
471:      */
472:     private function _installAddFrames() {
473: 
474:         // Initializing attribute array
475:         $attributes = array();
476: 
477:         $frameCount = count(parent::$XmlFrames->frame);
478:         for ($i = 0; $i < $frameCount; $i++) {
479: 
480:             // Build attributes with security checks
481:             foreach (parent::$XmlFrames->frame[$i]->attributes() as $sKey => $sValue) {
482:                 $attributes[$sKey] = cSecurity::escapeString($sValue);
483:             }
484: 
485:             // Check for valid area
486:             if (!in_array($attributes['area'], $this->_getInstalledAreas())) {
487:                 parent::error(i18n('Defined area', 'pim') . ' <strong>' . $attributes['area'] . '</strong> ' . i18n('are not found on your CONTENIDO installation. Please contact your plugin author.', 'pim'));
488:             }
489: 
490:             // Create a new entry at *_files
491:             $file = $this->_ApiFileCollection->create($attributes['area'], $attributes['name'], $attributes['filetype']);
492: 
493:             // Create a new entry at *_frame_files
494:             if (!empty($attributes['frameId'])) {
495:                 $this->_ApiFrameFileCollection->create($attributes['area'], $attributes['frameId'], $file->get('idfile'));
496:             }
497:         }
498:     }
499: 
500:     /**
501:      * Add entries at *_nav_main
502:      *
503:      * @access private
504:      * @return void
505:      */
506:     private function _installAddNavMain() {
507: 
508:         // Get Id of plugin
509:         $pluginId = parent::_getPluginId();
510: 
511:         $navCount = count(parent::$XmlNavMain->nav);
512:         for ($i = 0; $i < $navCount; $i++) {
513:             // Security check
514:             $location = cSecurity::escapeString(parent::$XmlNavMain->nav[$i]);
515: 
516:             // Create a new entry at *_nav_main
517:             $navMain = $this->_ApiNavMainCollection->create($location);
518: 
519:             // Set a relation
520:             $this->_PimPluginRelationsCollection->create($navMain->get('idnavm'), $pluginId, 'navm');
521:         }
522:     }
523: 
524:     /**
525:      * Add entries at *_nav_sub
526:      *
527:      * @access private
528:      * @return void
529:      */
530:     private function _installAddNavSub() {
531: 
532:         // Initializing attribute array
533:         $attributes = array();
534: 
535:         // Get Id of plugin
536:         $pluginId = parent::_getPluginId();
537: 
538:         $navCount = count(parent::$XmlNavSub->nav);
539:         for ($i = 0; $i < $navCount; $i++) {
540: 
541:             // Build attributes
542:             foreach (parent::$XmlNavSub->nav[$i]->attributes() as $key => $value) {
543:                 $attributes[$key] = $value;
544:             }
545: 
546:             // Convert area to string
547:             $attributes['area'] = cSecurity::toString($attributes['area']);
548: 
549:             // Check for valid area
550:             if (!in_array($attributes['area'], $this->_getInstalledAreas())) {
551:                 parent::error(i18n('Defined area', 'pim') . ' <strong>' . $attributes['area'] . '</strong> ' . i18n('are not found on your CONTENIDO installation. Please contact your plugin author.', 'pim'));
552:             }
553: 
554:             // Create a new entry at *_nav_sub
555:             $item = $this->_ApiNavSubCollection->create($attributes['navm'], $attributes['area'], $attributes['level'], parent::$XmlNavSub->nav[$i], 1);
556: 
557:             // Set a relation
558:             $this->_PimPluginRelationsCollection->create($item->get('idnavs'), $pluginId, 'navs');
559:         }
560:     }
561: 
562:     /**
563:      * Add specific sql queries
564:      *
565:      * @access private
566:      * @return void
567:      */
568:     private function _installAddSpecificSql() {
569:         $cfg = cRegistry::getConfig();
570:         $db = cRegistry::getDb();
571: 
572:         if (parent::getMode() == 1) { // Plugin is already extracted
573:             $tempSqlFilename = $cfg['path']['contenido'] . $cfg['path']['plugins'] . $this->_getPluginFoldername() . DIRECTORY_SEPARATOR . 'plugin_install.sql';
574:         } elseif (parent::getMode() == 2 || parent::getMode() == 4) { // Plugin
575:                                                                       // is
576:                                                                       // uploaded
577:                                                                       // or /
578:                                                                       // and
579:                                                                       // update
580:                                                                       // mode
581:             $tempSqlFilename = parent::$_PimPluginArchiveExtractor->extractArchiveFileToVariable('plugin_install.sql', 0);
582:         }
583: 
584:         if (!cFileHandler::exists($tempSqlFilename)) {
585:             return;
586:         }
587: 
588:         $tempSqlContent = cFileHandler::read($tempSqlFilename);
589:         $tempSqlContent = str_replace("\r\n", "\n", $tempSqlContent);
590:         $tempSqlContent = explode("\n", $tempSqlContent);
591:         $tempSqlLines = count($tempSqlContent);
592: 
593:         $pattern = '/^(CREATE TABLE IF NOT EXISTS|INSERT INTO|UPDATE|ALTER TABLE) `?' . parent::SQL_PREFIX . '`?\b/';
594: 
595:         for ($i = 0; $i < $tempSqlLines; $i++) {
596:             if (preg_match($pattern, $tempSqlContent[$i])) {
597:                 $tempSqlContent[$i] = str_replace(parent::SQL_PREFIX, $cfg['sql']['sqlprefix'] . '_pi', $tempSqlContent[$i]);
598:                 $db->query($tempSqlContent[$i]);
599:             }
600:         }
601:     }
602: 
603:     /**
604:      * Add content types (*_type)
605:      *
606:      * @access private
607:      * @return void
608:      */
609:     private function _installAddContentTypes() {
610: 
611:         // Get Id of plugin
612:         $pluginId = parent::_getPluginId();
613: 
614:         $pattern = '/^CMS_.+/';
615: 
616:         $typeCount = count(parent::$XmlContentType->type);
617:         for ($i = 0; $i < $typeCount; $i++) {
618: 
619:             $type = cSecurity::toString(parent::$XmlContentType->type[$i]);
620: 
621:             if (preg_match($pattern, $type)) {
622: 
623:                 // Create new content type
624:                 $item = $this->_ApiTypeCollection->create($type, '');
625: 
626:                 // Set a relation
627:                 $this->_PimPluginRelationsCollection->create($item->get('idtype'), $pluginId, 'ctype');
628:             }
629:         }
630:     }
631: 
632:     /**
633:      * Add modules
634:      *
635:      * @access private
636:      * @return void
637:      */
638:     private function _installAddModules() {
639:         $cfg = cRegistry::getConfig();
640:         $module = new cApiModule();
641: 
642:         // Set path to modules path
643:         $modulesPath = $cfg['path']['contenido'] . $cfg['path']['plugins'] . $this->_getPluginFoldername() . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR;
644: 
645:         if (!is_dir($modulesPath)) {
646:             return false;
647:         }
648: 
649:         foreach (new DirectoryIterator($modulesPath) as $modulesFiles) {
650: 
651:             if (substr($modulesFiles->getBasename(), -4) == ".zip") {
652: 
653:                 // Import founded module
654:                 $module->import($modulesFiles->getBasename(), $modulesFiles->getBasename(), false);
655:             }
656:         }
657: 
658:         cFileHandler::recursiveRmdir($modulesPath);
659:     }
660: 
661:     /**
662:      * Add plugin dir
663:      *
664:      * @access private
665:      * @return void
666:      */
667:     private function _installAddDir() {
668:         $cfg = cRegistry::getConfig();
669: 
670:         // Build the new plugin dir
671:         $tempPluginDir = $cfg['path']['contenido'] . $cfg['path']['plugins'] . parent::$XmlGeneral->plugin_foldername . DIRECTORY_SEPARATOR;
672: 
673:         // Set destination path
674:         try {
675:             parent::$_PimPluginArchiveExtractor->setDestinationPath($tempPluginDir);
676:         } catch (cException $e) {
677:             parent::$_PimPluginArchiveExtractor->destroyTempFiles();
678:         }
679: 
680:         // Extract Zip archive files into the new plugin dir
681:         try {
682:             parent::$_PimPluginArchiveExtractor->extractArchive();
683:         } catch (cException $e) {
684:             parent::$_PimPluginArchiveExtractor->destroyTempFiles();
685:         }
686:     }
687: 
688: }
689: ?>
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0