Hi Alexander,

 

I have thought about a solution like that too, but here come some problems:

1.       plz do not kill already existing data from the database. 

2.       Running automated events makes it hard to predict performance, and 
what if you install an update by just copying over the existing files?

3.       What should happen, if the plugin gets broken (e.g. hard-drive 
failure, wrong upload, etc…)?

 

Another thought: what about making something like giving the responsability of 
the database-management to the shop itself?

 

Something like this (in the metadata.php):

 

'db' => array(

                'tables' => array(

                               "extend" => array(

                                               'oxarticles' => array(

                                                               array(

                                                                              
"name" => "smi_something",

                                                                              
"type" => "double"

                                                                              
// ... and other options to make it easy

                                                               ),

                                               ),

                                               'oxuser' => array(

                                               ),

                               ),

                               "create" => array(

                                               'smi_table1' => array(

                                                               array(

                                                                              
"name" => "oxid",

                                                                              
"type" => "oxid" // for generating oxids automaticly

                                                                              
// ... and other options to make it easy

                                                               ),

                                               ),

                                               'smi_table2' => array(

                                               ),

                               ),

                               "needed" => array(

                                               "smi_table3", // created by own 
special dedicated sql-file

                                               "smi_table4", // created by own 
special dedicated sql-file

                                               "smi_table5", // created by own 
special dedicated sql-file

                               ),

                ),

                'views' => array(

                               // ... like tables

                )

)

 

So we all can create nifty sql-files additionally if really needed, but can 
have automatics managed by oxid itself. It’s just a quick thought, maybe this 
is overpowered for just having sql-files removed J

 

Mit freundlichen Grüßen

Danny Althoff

_____________________________________

Danny Althoff
Software Developer

Die SHOPtimisten,-
Robertstr. 2
51105 Köln
Germany

fon +49 (0) 221 913999 – 17
fax +49 (0) 221 913999 – 98

[email protected]
www.die-shoptimisten.de <http://www.die-shoptimisten.de/> 

Die Shoptimisten UG (haftungsbeschränkt), Geschäftsführer: Jörg Scholtz
Sitz der Gesellschaft ist Köln, eingetragen beim Amtsgericht Köln, HRB 67004

Wichtiger Hinweis:
Diese E-Mail (inklusive etwaiger Anhänge) ist vertraulich und nur für den 
Adressaten bestimmt. Wenn Sie diese E-Mail irrtümlich erhalten haben, machen 
wir Sie darauf aufmerksam, dass Ihnen eine Kenntnisnahme, eine Vervielfältigung 
oder Weitergabe nicht gestattet ist. Bitte informieren Sie uns umgehend, 
löschen Sie die E-Mail und vernichten Sie etwaige Ausdrucke.

Important Note:
This e-mail (including any attachments) is confidential and intended only for 
the use of the address(es) named herein. If you have received this e-mail in 
error, you are hereby notified that any review, copying or distribution of it 
is strictly prohibited. Please inform us immediately and destroy the original 
e-mail and any printouts.

 P Save a tree...please don't print this e-mail unless you really need to

 

 

Von: [email protected] 
[mailto:[email protected]] Im Auftrag von Alexander Kludt
Gesendet: Freitag, 21. September 2012 14:18
An: [email protected]
Betreff: [oxid-dev-general] Improving metadata.php

 

Hi guys,

I was developing a new module today, and the metadata.php already makes a lot 
of things possible,
but I still need a way to do some initial things - like executing sql, maybe 
check some things, capture some 
use input or just to show some warnings. So my idea is to add a way to execute 
code "onInstall", "onUninstall", "onActivate", "onDeactivate" .

I don't know the mechanics of includinig metadata.php but maybe it could be 
done like this:

<?php

$sMetadataVersion = '1.1';

$aModule = array(
    'id'           => 'mymodule',
    'title'        => 'Some Module',
    'description'  => 'Does something',
    'thumbnail'    => 'module.png',
    'version'      => '1.0',
    'author'       => 'Aggrosoft',    
    'extend'      => array(
         ...
    ),
    'blocks' => array(
        ...
    ),
    ...
    'onInstall' => 'myModulOnInstall',
    'onUninstall' => 'myModulOnUninstall', 
    'onActivate' => 'myModulOnActivate', 
    'onDeactive' => 'myModulOnDeactivate', 
   
);


function myModulOnInstall ($aSomeInfosAboutTheShop?Module?State?){
  //Write down code to execute on install, return true on success, false if it 
fails
}

function myModulOnUninstall ($aSomeInfosAboutTheShop?Module?State?){
  //Write down code to execute on deinstallation, return true on success, false 
if it fails
} 

function myModulOnActivate ($aSomeInfosAboutTheShop?Module?State?){
  //Write down code to execute on activation, return true on success, false if 
it fails
} 

function myModulOnDeactivate ($aSomeInfosAboutTheShop?Module?State?){
  //Write down code to execute on deactivation, return true on success, false 
if it fails
} 

?>

Maybe wrapping an inner class maybe better which follows some kind of interface 
- so names will not conflict, or come up with some kind of naming sheme.
What do you think? Would this make your day easier? I think many modules can be 
improved with this.

-- 

mit freundlichen Grüßen
Alexander Kludt


__________________________
Phone: 09283-5925453
Fax: 09283-592671
Skype: kingschnulli
Email: [email protected]
Website: www.aggrosoft.de

__________________________
Aggrosoft it intelligence GbR
Tannstrasse 12
95111 Rehau
GERMANY

Sitz Rehau, Amtsgericht Hof
Steuernummer: 223/165/54508
Ust.-Id. Nr. gemäß § 27 a Umsatzsteuergesetz: DE260722773

___________________________
Diese Nachricht ist nur für den Empfänger () bestimmt, sollten
Sie nicht der Empfänger sein löschen Sie diese Nachricht
umgehend und geben Sie uns bitte per Email ([email protected]) Bescheid
über den fälschlichen Erhalt. 

<<image001.png>>

_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to