[otrs-cvs] module-tools CodeInstall.pl,1.2,1.3
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/module-tools
In directory lancelot:/tmp/cvs-serv8102
Modified Files:
CodeInstall.pl
Log Message:
Improved handling to be more similar to the DatabaseInstall script.
Author: ub
Index: CodeInstall.pl
===================================================================
RCS file: /home/cvs/module-tools/CodeInstall.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -2 -u -d -r1.2 -r1.3
--- CodeInstall.pl 20 Nov 2012 19:16:41 -0000 1.2
+++ CodeInstall.pl 22 Nov 2012 07:58:02 -0000 1.3
@@ -42,8 +42,12 @@
use Kernel::System::DB;
use Kernel::System::Time;
-use Kernel::System::XML;
+use Kernel::System::Package;
# call the script with the module name as first argument
my $Module = shift;
+if ( !-e $Module ) {
+ print "Can not find file $Module!\n";
+ exit 0;
+}
# create common objects
@@ -55,20 +59,24 @@
ConfigObject => $CommonObject{ConfigObject},
);
-$CommonObject{MainObject} = Kernel::System::Main->new(%CommonObject);
-$CommonObject{DBObject} = Kernel::System::DB->new(%CommonObject);
-$CommonObject{TimeObject} = Kernel::System::Time->new(%CommonObject);
-$CommonObject{XMLObject} = Kernel::System::XML->new(%CommonObject);
+$CommonObject{MainObject} = Kernel::System::Main->new(%CommonObject);
+$CommonObject{DBObject} = Kernel::System::DB->new(%CommonObject);
+$CommonObject{TimeObject} = Kernel::System::Time->new(%CommonObject);
+$CommonObject{XMLObject} = Kernel::System::XML->new(%CommonObject);
+$CommonObject{PackageObject} = Kernel::System::Package->new(%CommonObject);
-# create the package name
-my $CodeModule = 'var::packagesetup::' . $Module;
+my $PackageContent = $CommonObject{MainObject}->FileRead(
+ Directory => '.',
+ Filename => $Module,
+);
-# load the module
-if ( $CommonObject{MainObject}->Require($CodeModule) ) {
+my %Structure = $CommonObject{PackageObject}->PackageParse( String => $PackageContent );
- # create new instance
- $CommonObject{CodeObject} = $CodeModule->new(%CommonObject);
+if ( $Structure{CodeInstall} ) {
+ $CommonObject{PackageObject}->_Code(
+ Code => $Structure{CodeInstall},
+ Type => 'post',
+ Structure => \%Structure,
+ );
}
-print "Run CodeInstall()\n";
-$CommonObject{CodeObject}->CodeInstall();
print "... done\n"
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log