通过joomla组件安装sql文件

时间:2013-04-02 07:34:42

标签: php joomla joomla1.5

最近我们为我们的客户制作了一个自定义组件。现在我们通过以下xml文件构建了该组件的安装文件:

<?xml version="1.0"?>
<install type="component" version="1.5.0">  
<name>customblog</name>  
<author>Jogesh Sharma</author>  
<creationDate>March 2013</creationDate>  
<copyright>Copyright (C) 2013 Open Source Matters. All rights reserved.</copyright>  
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>  
<authorEmail>hello@webomnizz.com</authorEmail>  
<authorUrl>http://webomnizz.com</authorUrl>  
<version>1.5.0</version>  
<description>This component manage all the Blog sections!</description>  
<installfile>install.customblog.php</installfile>  
<uninstallfile>uninstall.customblog.php</uninstallfile>  

<files>      
    <filename>customblog.php</filename>      
    <filename>customblog.html.php</filename>
</files>
<files folder="images">
    <filename>style.css</filename>
    <filename>plus-icon.png</filename>
    <filename>twitter-icon.png</filename>
    <filename>facebook-icon.png</filename>
</files>      

<install>      
    <sql>          
        <file driver="mysql">install.mysql.sql</file>      
    </sql>  
</install>    

<uninstall>      
    <sql>          
        <file driver="mysql">uninstall.mysql.sql</file>      
    </sql>  
</uninstall>      

<administration>      
    <menu img="js/ThemeOffice/component.png">Blog Component</menu>      
    <submenu>          
        <menu link="option=com_customblog">Blog</menu>
        <menu link="option=com_customblog&amp;c=general">General Options</menu>
    </submenu>            
    <files>          
        <filename>install.mysql.sql</filename>          
        <filename>uninstall.mysql.sql</filename>          
        <filename>admin.customblog.php</filename>          
        <filename>admin.customblog.html.php</filename>          
        <filename>toolbar.customblog.php</filename>          
        <filename>toolbar.customblog.html.php</filename>          
        <filename>index.html</filename>
    </files>
    <files folder="tables">
        <filename>customblog.php</filename> 
        <filename>general.php</filename>
    </files>  
</administration>
</install>

但问题是我们的sql文件install.mysql.sql未安装在joomla中,我不知道为什么,并且在安装过程中它没有提供任何错误消息等。我正在使用joomla 1.5.26,

谁能告诉我我错过了什么?

更新:这是我的install.mysql.sql文件:

CREATE TABLE IF NOT EXISTS `#__blog` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `title` varchar(255) NOT NULL,
 `full_text` mediumtext NOT NULL,
 `state` tinyint(1) NOT NULL,
 `publish_up` date NOT NULL,
 `gp_button` varchar(255) DEFAULT NULL,
 `fb_button` varchar(255) DEFAULT NULL,
 `tw_button` varchar(255) DEFAULT NULL,
 `user_id` tinyint(2) NOT NULL,
 `social_key` tinyint(2) DEFAULT NULL,
 PRIMARY KEY (`id`)
);


CREATE TABLE `#__generalopt` (
  `id` int(2) unsigned NOT NULL auto_increment,
  `title` varchar(200) default NULL,
  `gp_status` tinyint(2) default NULL,
  `fb_status` tinyint(2) default NULL,
  `tw_status` tinyint(2) default NULL,
  `userImg` varchar(200) default NULL,
  PRIMARY KEY  (`id`)
);
INSERT INTO `jos_generalopt` VALUES(1, 'General Options', 1, 1, 1, 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/User_icon_2.svg/120px-User_icon_2.svg.png'); 

结构enter image description here

1 个答案:

答案 0 :(得分:0)

您必须将install.mysql.sql放在admin文件夹中,即使路径中未提及它。保持xml原样,只需创建一个新文件夹admin并在那里移动install.mysql.sql,然后Joomla就能找到它