Implements hook "module.install.before"
@param null|string
543653
public function hookModuleInstallBefore(&$result)
    {
        $library = $this->library->get('jquery');

        if (empty($library['version']) || version_compare($library['version'], '1.8.0', '<')) {
            $result = gplcart_text('Jquery Mobile requires Jquery >= 1.8.0');
        }
    }
862542
public function beforeCompile(): void
	{
		$builder = $this->getContainerBuilder();

		// Register as services
		foreach ($builder->findByType(IContainerAware::class) as $service) {
			$service->addSetup('setContainer');
		}
	}
465725
private function before(callable $before): void
    {
        if ($before instanceof Closure) {
            $this->options["before"] = $before->bindTo($this);
        } else {
            $this->options["before"] = $before;
        }
    }
729301
def insertBefore(self, node: AbstractNode,
                     ref_node: AbstractNode) -> AbstractNode:
        """"""
        return self._insert_before(node, ref_node)
87378
protected function resolveBefore($before)
    {
        $getBefore = $this->resolveMiddleware($before);

        return function (Request $request, Application $app) use ($getBefore) {
            $callback = $getBefore($request);
            if (!is_callable($callback)) {
                return null;
            }

            return $callback($request, $app);
        };
    }
771089
protected function createBeforeFilter() {
    $before = $this->before;

    // closure that iterates over all before filters
    return function ($request) use ($before) {
      foreach ($before as $filter) {
        $response = $filter->onBefore($request);
        if (!is_null($response)) {
          return $response;
        }
      }

      return null;
    };
  }
588730
@Override
    public DEBBuilder setPreInstallation(String script, String interpreter)
    {
        setMaintainerScript("preinst", script, interpreter);
        return this;
    }
886036
def insert_before(self, key, new_item, instance=0):
        """"""
        self._insert_item(key, new_item, instance, False)
1199522
public function hookModuleInstallBefore(&$result)
    {
        if (!class_exists('ZipArchive')) {
            $result = $this->getTranslationModel()->text('Class ZipArchive does not exist');
        } else {

            try {
                $this->db->importScheme('backup', $this->getDbScheme());
            } catch (Exception $ex) {
                $result = $ex->getMessage();
            }
        }
    }
1264140
public function runBeforeSystem() {
        if($this->_beforeSystem !== null) {
            foreach($this->_beforeSystem as $hookProvider) {
                $hookProvider->doBeforeSystem();
            }
        }
    }
1148178
public function runBeforeView($context = null) {
        if($this->_beforeView !== null) {
            foreach($this->_beforeView as $hookProvider) {
                $hookProvider->doBeforeView($context);
            }
        }
    }
318924
function _initModulesOnElement(enabledElement) {
  const modules = store.modules;

  Object.keys(modules).forEach(function(key) {
    if (typeof modules[key].enabledElementCallback === 'function') {
      modules[key].enabledElementCallback(enabledElement);
    }
  });
}
1367692
function install($dir = null, &$result)
    {
        // Get a database connector object
        $db = Factory::getDBO();
        $result['status'] = false;
        $result['name'] = null;
        if (!$dir && !is_dir(Path::clean($dir))) {
            $this->installer->abort(Text::_('INSTALL_INVALID_PATH'));
	        throw new RuntimeException(Text::_('INSTALL_INVALID_PATH'));
        } else {
            $this->installer->setPath('source', $dir);

            // Get the extension manifest object
            $manifest = $this->getManifest($dir);
            if (is_null($manifest)) {
                $this->installer->abort(Text::_('INSTALL_NOT_VALID_PLUGIN'));
	            throw new RuntimeException(Text::_('INSTALL_NOT_VALID_PLUGIN'));
            } else {
                $this->manifest = $manifest;

	            $framework = JFusionFramework::getComposerInfo();

	            $version = $this->getAttribute($this->manifest, 'version');

	            /**
	             * ---------------------------------------------------------------------------------------------
	             * Manifest Document Setup Section
	             * ---------------------------------------------------------------------------------------------
	             */
	            // Set the extensions name
	            /**
	             * Check that the plugin is an actual JFusion plugin
	             */
	            $name = $this->manifest->name;
	            $name = $this->filterInput->clean($name, 'string');

	            if (!$framework || !$version || version_compare($framework->version, $version) >= 0 || $framework->version == 'dev-master') {
		            $result['name'] = $name;
		            $this->name = $name;

		            // installation path
		            $this->installer->setPath('extension_root', JFusionFramework::getPluginPath($name));
		            // get files to copy

		            /**
		             * ---------------------------------------------------------------------------------------------
		             * Filesystem Processing Section
		             * ---------------------------------------------------------------------------------------------
		             */

		            // If the plugin directory does not exist, lets create it
		            $created = false;
		            if (!file_exists($this->installer->getPath('extension_root'))) {
			            if (!$created = Folder::create($this->installer->getPath('extension_root'))) {
				            $msg = Text::_('PLUGIN') . ' ' . Text::_('INSTALL') . ': ' . Text::_('INSTALL_FAILED_DIRECTORY') . ': "' . $this->installer->getPath('extension_root') . '"';
				            $this->installer->abort($msg);
				            throw new RuntimeException($name . ': ' . $msg);
			            }
		            }
		            /**
		             * If we created the plugin directory and will want to remove it if we
		             * have to roll back the installation, lets add it to the installation
		             * step stack
		             */
		            if ($created) {
			            $this->installer->pushStep(array('type' => 'folder', 'path' => $this->installer->getPath('extension_root')));
		            }
		            // Copy all necessary files
		            if ($this->installer->parseFiles($this->manifest->files[0], -1) === false) {
			            // Install failed, roll back changes
			            $this->installer->abort();
			            throw new RuntimeException($name . ': ' . Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('INSTALL') . ': ' . Text::_('FAILED'));
		            } else {
			            $vendor = $dir . '/vendor';
			            if (is_dir(Path::clean($vendor))) {
				            Folder::copy($vendor, $this->installer->getPath('extension_root') . '/vendor', '', true);
			            }
			            $language = $dir . '/language';
			            if (is_dir(Path::clean($language))) {
				            Folder::copy($language, $this->installer->getPath('extension_root') . '/language', '', true);
			            }
			            /**
			             * ---------------------------------------------------------------------------------------------
			             * Database Processing Section
			             * ---------------------------------------------------------------------------------------------
			             */
			            //let's check to see if a plugin with the same name is already installed
			            $query = $db->getQuery(true)
				            ->select('id')
				            ->from('#__jfusion')
				            ->where('name = ' . $db->quote($name));

			            $db->setQuery($query);

			            $plugin = $db->loadObject();
			            if (!empty($plugin)) {
				            if (!$this->installer->isOverwrite()) {
					            // Install failed, roll back changes
					            $msg = Text::_('PLUGIN') . ' ' . Text::_('INSTALL') . ': ' . Text::_('PLUGIN') . ' "' . $name . '" ' . Text::_('ALREADY_EXISTS');
					            $this->installer->abort($msg);
					            throw new RuntimeException($name . ': ' . $msg);
				            } else {
					            //set the overwrite tag
					            $result['overwrite'] = 1;
				            }
			            } else {
				            //prepare the variables
				            $result['overwrite'] = 0;
				            $plugin_entry = new stdClass;
				            $plugin_entry->id = null;
				            $plugin_entry->name = $name;
				            $plugin_entry->dual_login = 0;
				            //now append the new plugin data
				            try {
					            $db->insertObject('#__jfusion', $plugin_entry, 'id');
				            } catch (Exception $e) {
					            // Install failed, roll back changes
					            $msg = Text::_('PLUGIN') . ' ' . Text::_('INSTALL') . ' ' . Text::_('ERROR') . ': ' . $e->getMessage();
					            $this->installer->abort($msg);
					            throw new RuntimeException($name . ': ' . $msg);
				            }
				            $this->installer->pushStep(array('type' => 'plugin', 'id' => $plugin_entry->id));
			            }
			            /**
			             * ---------------------------------------------------------------------------------------------
			             * Finalization and Cleanup Section
			             * ---------------------------------------------------------------------------------------------
			             */

			            //check to see if this is updating a plugin that has been copied
			            $query = $db->getQuery(true)
				            ->select('name')
				            ->from('#__jfusion')
				            ->where('original_name = ' . $db->quote($name));

			            $db->setQuery($query);
			            $copiedPlugins = $db->loadObjectList();
			            foreach ($copiedPlugins as $plugin) {
				            //update the copied version with the new files
//				            $this->copy($name, $plugin->name, true);
			            }

			            if ($result['overwrite'] == 1) {
				            $msg = Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('UPDATE') . ': ' . Text::_('SUCCESS');
			            } else {
				            $msg = Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('INSTALL') . ': ' . Text::_('SUCCESS');
			            }
			            $result['message'] = $name . ': ' . $msg;
			            $result['status'] = true;
		            }
	            } else {
		            $msg = Text::_('PLUGIN') . ' ' . $name . ': ' . Text::_('FAILED') . ' ' . Text::_('NEED_JFUSION_VERSION') . ' "' . $version . '" ' . Text::_('OR_HIGHER');
		            $this->installer->abort($msg);
		            throw new RuntimeException($name . ': ' . $msg);
	            }
            }
        }
        return $result;
    }
165830
protected function before() {
		if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
			$this->connection->executeUpdate('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"');
		} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
			$this->connection->executeUpdate('SET FOREIGN_KEY_CHECKS=0');
		} else if($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
			$this->connection->executeUpdate('PRAGMA foreign_keys = OFF');
		}
	}
44667
public function update($module, $options = null)
    {
        $module = strtolower($module);
        $options = is_null($options) ? array() : $options;
        $modules = $this->findModules();
       
        // Resolve deps
        $deps = $this->resolveDependencies(
            $module
        );
        
        if (!$deps->offsetExists($module)) {
            $deps->offsetSet($module, 'X');
        }
        
        // Setup all dependencies
        foreach($deps as $depModule => $depVersion){

            if(!$this->hasSetupService($depModule)){
                continue;
            }
        
            $setup = $this->initSetupService($depModule);
            $operation = 'setup';
            $args = array();
        
            if ($depModule == $module) {
                $args['options'] = $options;
            }
             
            // complete existing installation
            $setup->exec(
                'setup',
                $args
            );
        }
        
        return true;
    }
64950
def insert_before_each(middleware, *args, &block)
      self.stack = stack.reduce([]) do |carry, item|
        carry.push([middleware, args, block], item)
      end
    end
1279902
public function run_befores($scope) {
    if ($this->_parent) {
      $this->_parent->run_befores($scope);
    }
    
    foreach ($this->_befores as $before) {
      $before($scope);
    }
  }