Checks a module ID
@param string $module_id
@return boolean
@throws UnexpectedValueException
189005
public function checkModuleId($module_id)
    {
        if (!$this->module->isValidId($module_id)) {
            throw new UnexpectedValueException($this->translation->text('Invalid module ID'));
        }

        return true;
    }
105684
def _check_database_id(database_id):
    
    if database_id != u"":
        msg = _DATABASE_ID_TEMPLATE.format(database_id)
        raise ValueError(msg)
475361
public function read_option(string $id_option = null): ?bool
  {
    if ( bbn\str::is_uid($id_option) ){
      $root = self::get_option_id('options');
      $id_to_check = $this->opt->from_code('opt'.$id_option, $root);
      return $this->has($id_to_check, 'options');
    }
    return null;
  }
364205
public function canUninstall($module_id)
    {
        if ($this->module->isActiveTheme($module_id)) {
            $error = $this->translation->text('Modules with "theme" type and active status cannot be disabled/uninstalled');
            throw new UnexpectedValueException($error);
        }

        if ($this->module->isLocked($module_id)) {
            throw new UnexpectedValueException($this->translation->text('Module is locked in code'));
        }

        return $this->checkDependentModules($module_id, $this->module->getList());
    }
575606
def register_flag_by_module_id(self, module_id, flag):
    
    flags_by_module_id = self.flags_by_module_id_dict()
    flags_by_module_id.setdefault(module_id, []).append(flag)
674052
public function check($container_type, $container_id)
    {
        if (strtolower($container_type) === 'default') {
            return true;
        }

        $classname = 'Lemurro\\Api\\App\\Checker\\File' . ucfirst($container_type);

        if (class_exists($classname)) {
            $class = new $classname($this->dic);

            return call_user_func([$class, 'check'], $container_id);
        } else {
            /** @var Logger $log */
            $log = $this->dic['log'];

            $log->error('/File/FileRights.php: Unknown class "' . $classname . '"');

            return false;
        }
    }
67743
public function validateModuleID()
    {
        if (!empty($this->moduleID)) {
            $module = Yii::$app->getModule($this->moduleID);
            if ($module === null) {
                $this->addError('moduleID', "Module '{$this->moduleID}' does not exist.");
            }
        }
    }
47726
public function getUserMethodStorage($method_id)
    {
        $declaring_method_id = $this->getDeclaringMethodId($method_id);

        if (!$declaring_method_id) {
            throw new \UnexpectedValueException('$storage should not be null for ' . $method_id);
        }

        $storage = $this->getStorage($declaring_method_id);

        if (!$storage->location) {
            return null;
        }

        return $storage;
    }
744104
def db_check( block_id, opcode, op, txid, vtxindex, checked, db_state=None ):
   
   print "\nreference implementation of db_check\n"
   return False
1287119
public function getStorage($method_id)
    {
        list($fq_class_name, $method_name) = explode('::', $method_id);

        $class_storage = $this->classlike_storage_provider->get($fq_class_name);

        $method_name_lc = strtolower($method_name);

        if (!isset($class_storage->methods[$method_name_lc])) {
            throw new \UnexpectedValueException('$storage should not be null for ' . $method_id);
        }

        return $class_storage->methods[$method_name_lc];
    }
649339
public function setID($page_id)
    {
        if ($page_id == $this->page_id) {
            return true;
        }

        if (!$this->isValidId($page_id)) {
            return false;
        }

        if(!$this->pageOrder->changeId($this, $page_id)){
            return false;
        }

        $this->page_id = $page_id;
        return true;
    }
718220
public function disable($module_id)
    {
        try {
            $result = $this->canDisable($module_id);
        } catch (Exception $ex) {
            $result = $ex->getMessage();
        }

        $this->hook->attach("module.disable.before|$module_id", $result, $this);

        if ($result !== true) {
            return $result;
        }

        if ($this->module->isInstalled($module_id)) {
            $this->module->update($module_id, array('status' => false));
        } else {
            $this->module->add(array('status' => false, 'module_id' => $module_id));
        }

        $this->setOverrideConfig();

        $this->hook->attach("module.disable.after|$module_id", $result, $this);
        return $result;
    }
485841
protected function check_object_id( $object_id ) {
		$fetcher = new SiteFetcher();
		$site    = $fetcher->get_check( $object_id );
		return $site->blog_id;
	}
904000
public static function userFeatureExists(string $feature_code, $module_id = null) : bool {
		if (!isset($module_id)) {
			$module_id = \Application::$controller->module_id;
		}
		// fetures third
		if (is_null(\Object\Controller::$cached_features) && !\Object\Error\Base::$flag_database_tenant_not_found) {
			\Object\Controller::$cached_features = \Object\ACL\Resources::getStatic('features', 'primary');
		}
		// super admin
		if (\User::get('super_admin')) {
			if (empty(\Object\Controller::$cached_features[$feature_code]['prohibitive'])) {
				return true;
			}
		}
		// user first
		$features = \User::get('features');
		if (!empty($features)) {
			$result = self::userFeatureExistsOne($features, $feature_code, $module_id);
			if ($result == 1) {
				return true;
			} else if ($result == 2) { // disabled feature
				return false;
			}
		}
		// roles second
		if (is_null(\Object\Controller::$cached_roles) && !\Object\Error\Base::$flag_database_tenant_not_found) {
			\Object\Controller::$cached_roles = \Object\ACL\Resources::getStatic('roles', 'primary');
		}
		foreach (\User::roles() as $v) {
			$result = self::userFeatureExistsRole($v, $feature_code, $module_id);
			if ($result == 1) {
				return true;
			} else if ($result == 2) { // disabled feature
				return false;
			}
		}
		// teams last
		if (is_null(\Object\Controller::$cached_teams) && !\Object\Error\Base::$flag_database_tenant_not_found) {
			\Object\Controller::$cached_teams = \Object\ACL\Resources::getStatic('roles', 'teams');
		}
		foreach (\User::teams() as $v) {
			$features = \Object\Controller::$cached_teams[$v]['features'] ?? null;
			if (!empty($features)) {
				$result = self::userFeatureExistsOne($features, $feature_code, $module_id);
				if ($result == 1) {
					return true;
				} else if ($result == 2) { // disabled feature
					return false;
				}
			}
		}
		return false;
	}
392671
private static function userFeatureExistsOne(array $features, string $feature_code, $module_id = null) : int {
		$result = $features[$feature_code][$module_id] ?? null;
		if ($result === 0) {
			return 1;
		} else if ($result === 1) {
			return 2;
		}
		return 0;
	}
120669
protected function isEnabledModule($module_id)
    {
        $sql = 'SELECT module_id FROM module WHERE module_id=? AND status > 0';
        $result = $this->db->fetchColumn($sql, array($module_id));
        return !empty($result);
    }
661994
public function validate(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canValidate($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        foreach ($moduleSetting->getValue() as $classToBePatched => $moduleClass) {
            if ($this->shopAdapter->isNamespace($classToBePatched)) {
                $this->validateClassToBePatchedNamespace($classToBePatched);
            }
        }
    }