Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何在禁用状态下安装扩展?_Xml_Joomla_Components_Joomla2.5_Joomla3.0 - Fatal编程技术网

Xml 如何在禁用状态下安装扩展?

Xml 如何在禁用状态下安装扩展?,xml,joomla,components,joomla2.5,joomla3.0,Xml,Joomla,Components,Joomla2.5,Joomla3.0,这是扩展名的XML文件: <?xml version="1.0" encoding="UTF-8" ?> <extension method="upgrade" type="component" version="2.5"> <name>CS_KIALAPLUGIN</name> <creationDate>March 17 2013</creationDate> <author>Complusoft</a

这是扩展名的XML文件:

<?xml version="1.0" encoding="UTF-8" ?>
<extension method="upgrade" type="component" version="2.5">
<name>CS_KIALAPLUGIN</name>
<creationDate>March 17 2013</creationDate>
<author>Complusoft</author>
<authorUrl>http://www.complusoft.es</authorUrl>
<copyright></copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>2.0.22c</version>
<description>VMKIALA_PLUGIN_DESC</description>

<scriptfile>install/kiala.php</scriptfile>

<administration>
        <files>
                <filename>kialaplugin.php</filename>
        </files>

</administration>

</extension>

基亚拉普卢金
2013年3月17日
Complusoft
http://www.complusoft.es
http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
2.0.22摄氏度
VMKIALA_插件描述
安装/kiala.php
kialaplugin.php

我正在寻找一个参数,该参数安装此扩展名时禁用而不是启用。

因此此参数存在于xml文件中。所以你有两个主要的选择

  • 您必须在Joomla的扩展管理器组件中禁用它
  • 您可以执行db请求以取消发布脚本文件中的扩展名

  • 终于有时间测试我之前发送给您的代码,它运行良好:

    script.php

    <?php 
    defined('_JEXEC') or die('Restricted access');
    
    class com_kialapluginInstallerScript
    {
        function install($parent) 
        {
            echo '<p>Install Successful</p>';
        }
    
        function postflight( $type, $parent )
        {
            $db = JFactory::getDbo();
    
            $query = $db->getQuery(true);
    
            $fields = array(
                $db->quoteName('enabled') . ' = 0'
            );
    
            $conditions = array(
                $db->quoteName('element') . ' = ' . $db->quote('com_kialaplugin')
            );
    
            $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
    
            $db->setQuery($query);
    
            $result = $db->query();
        }
    }
    
    ?>
    
    
    

    希望这对您有所帮助,当您回到
    install/kiala.php
    中的聊天时,它会给您发送zip,创建一个函数,在
    #uu extensions
    数据库表中运行数据库查询以禁用它,并在
    postflight
    函数中调用该函数。@Loder您能解释一下postflight吗?从未听说过:(基本上,在安装或更新扩展时,您可以在设置的时间运行安装脚本中的代码:@Lodder我刚才正在阅读,但我不确定从何处获取$type和$parent?我制作了一个类似的函数,但它不起作用。我将能够在一段时间内用一些代码启动您。我尝试将其放入脚本中。)XML文件,但它不起作用。看起来脚本要么在安装之前运行,要么在安装的同时运行,它在数据库中还没有找到组件。我的意思是在这个脚本文件中
    install/kiala.php
    -但是Lodder让你走上了正确的轨道:)