Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 4:52 am (All times are UTC )

 




Post new topic Reply to topic  [ 5 posts ] 
Author Message
Posted: Fri Aug 28, 2009 5:09 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Aug 28, 2008 4:24 am
Posts: 5
Hi!

I am developing a core hack for Joomla 1.5.14.

In which some files will be replaced.
and a table in database will be altered and a new field will be added.

Files are ready!!
MYSQL query is ready!!

Now i dont know what to call it.
Module Plugin or what.

My question is is there a way that i make a package which included this sql query and alter table of core Joomla.

To replace the files i know the hierarchical files should be zipped and uploaded using admin backend.
Now Problem comes how to get that query executed.

I tried using an install.name.php file calling it using name.xml file .

But it does not work.

Please help in this matter so i can contribute to Joomla community.

Regards
Xaurav


Top
  E-mail  
 
Posted: Fri Aug 28, 2009 5:15 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Aug 28, 2008 4:24 am
Posts: 5
and this is the code for
Install.name.php i am using.

Code:
<?php
/**
*
*
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');

// Initialize the database
$db =& JFactory::getDBO();
$update_queries = array ('This is MYSQL query');

// Perform all queries
foreach( $update_queries as $query ) {
    $db->setQuery( $query );
    $db->query();
}
?>



Here goes the name.xml code

Code:
<?xml version="1.0" encoding="utf-8"?>
<install type="i dont know" version="1.0.0" group="content">
    <name>myworkname</name>
    <author>xaurav</author>
    <creationDate>29/08/2009</creationDate>
    <license>GNU/GPL</license>
    <version>1.0</version>
    <description>Description and nature of this work</description>
    <installfile>install.name.php</installfile>

    <files folder="folder">
        <filename>file.php</filename>
    </files>

</install>


Top
  E-mail  
 
Posted: Fri Aug 28, 2009 5:59 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Wed Apr 15, 2009 5:33 pm
Posts: 280
Location: Fortaleza, CE
xinckick1 wrote:
Hi!

I am developing a core hack for Joomla 1.5.14.

In which some files will be replaced.
and a table in database will be altered and a new field will be added.

Files are ready!!
MYSQL query is ready!!

Now i dont know what to call it.
Module Plugin or what.

My question is is there a way that i make a package which included this sql query and alter table of core Joomla.

To replace the files i know the hierarchical files should be zipped and uploaded using admin backend.
Now Problem comes how to get that query executed.

I tried using an install.name.php file calling it using name.xml file .

But it does not work.

Please help in this matter so i can contribute to Joomla community.

Regards
Xaurav

Be aware that only components can execute sql and php at install time.
Place this in your xml install file:

Code:
<install>
   <sql>
      <file driver="mysql" charset="utf8">install.mysql.sql</file>
   </sql>
</install>


And then add a file named install.mysql.sql to your package. All sql in that file will be executed when you install your hack component.

Hope it helps...

_________________
-------------------------------------------------------------------
Nailson Oliveira - http://imagineseusite.com.br/
-------------------------------------------------------------------


Top
  E-mail  
 
Posted: Sat Aug 29, 2009 9:10 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Aug 28, 2008 4:24 am
Posts: 5
Hello Thanks for quick reply.

But i get this error

Unable to find install package

Can you tell me , how to setup an xml file to overwrite existing files

also add and sql file to do changes in mysql database .

Regards
Xaurav


Top
  E-mail  
 
Posted: Sat Aug 29, 2009 3:31 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Aug 07, 2009 4:34 pm
Posts: 9
Location: Munich, Germany
You have to setup a extensionname.xml, in the root of the packed zip.

This file should look like this (if you want to run it as a Joomla 1.5 component):

http://docs.joomla.org/Components:xml_installfile

If you need to run a php file (for the table alter, and you will need one for overwriting the core files.. With the xml and file listing and the standard joomla installer you won't be happy). So just use it to start the install.extension.php and do the rest by your own script.

After description:

</description>
<installfile>install.extensionname.php</installfile>
<uninstallfile>uninstall.extensionname.php</uninstallfile>

etc.

And if you replace core files, then please make sure that you backup them (copy to a folder etc.) and restore them with the uninstall php file.

Ah the install php file has to start like this:

defined( '_JEXEC' ) or die ( 'Restricted access' );
function com_install()
{
Your code....

I hope you know what you are doing ;) No offense!

Remember: He first unpacks the zip to tmp then runs your install php, so you copy / alter the files at this time! And you will have to alter the tables in the PHP with a mysql query not within the install.mysql.sql! Except you wanna drop the core tables before :D

Best regards,

Yves

_________________
lunajoom.de - Joomla 1.5 extension development

Help testing and optimizing Hotspots - an very advanced Google Map Manager


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

Quick reply

 



Who is online

Users browsing this forum: PommeVerte, serge06, TuDogs2000 and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group