Skip to content

Commit

Permalink
Replace PHP5 by PHP7
Browse files Browse the repository at this point in the history
Define the PHP version globally so we have to change
this single place next time.
  • Loading branch information
lslezak committed Aug 14, 2018
1 parent 381b2b0 commit 05f412d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/include/http-server/wizard-dialog.rb
Expand Up @@ -145,8 +145,8 @@ def WizardSequence2
{ :abort => fun_ref(method(:ReallyAbort), "boolean ()") }
)
if ret == :next
enable_php5 = Convert.to_boolean(
UI.QueryWidget(Id(:scr_mod_php5), :Value)
enable_php = Convert.to_boolean(
UI.QueryWidget(Id(:scr_mod_php), :Value)
)
enable_perl = Convert.to_boolean(
UI.QueryWidget(Id(:scr_mod_perl), :Value)
Expand All @@ -157,7 +157,7 @@ def WizardSequence2
# boolean enable_ruby=(boolean) UI::QueryWidget( `id(`scr_mod_ruby), `Value );

Builtins.y2milestone("Saving script modules")
Builtins.y2milestone("PHP5 support %1", enable_php5)
Builtins.y2milestone("PHP support %1", enable_php)
Builtins.y2milestone("Perl support %1", enable_perl)
Builtins.y2milestone("Python support %1", enable_python)
# y2milestone("Ruby support %1", enable_ruby);
Expand All @@ -169,7 +169,7 @@ def WizardSequence2
)
end
# add selected modules to that list
YaST::HTTPDData.ModifyModuleList(["php5"], enable_php5)
YaST::HTTPDData.ModifyModuleList(["php#{YaST::HTTPDData.PhpVersion}"], enable_php)
YaST::HTTPDData.ModifyModuleList(["perl"], enable_perl)
YaST::HTTPDData.ModifyModuleList(["python"], enable_python)
# YaST::HTTPDData::ModifyModuleList ([ "ruby" ], enable_ruby);
Expand Down
17 changes: 6 additions & 11 deletions src/modules/HttpServerWidgets.rb
Expand Up @@ -3501,15 +3501,10 @@ def validateListenInterfaces(key, event)
end
end
def initScriptModules(key)
enable_php5 = false
enable_perl = false
enable_python = false
# boolean enable_ruby=false;
modules = YaST::HTTPDData.GetModuleList
enable_php5 = true if Builtins.contains(modules, "php5")
enable_perl = true if Builtins.contains(modules, "perl")
enable_python = true if Builtins.contains(modules, "python")
# if (contains(modules, "ruby")) enable_ruby = true;
enable_php = Builtins.contains(modules, "php#{YaST::HTTPDData.PhpVersion}")
enable_perl = Builtins.contains(modules, "perl")
enable_python = Builtins.contains(modules, "python")

UI.ReplaceWidget(
Id(:scr_mod_replace),
Expand All @@ -3519,9 +3514,9 @@ def initScriptModules(key)
VSpacing(3), #translators: checkbox - support for php script language
Left(
CheckBox(
Id(:scr_mod_php5),
_("Enable &PHP5 Scripting"),
enable_php5
Id(:scr_mod_php),
_("Enable &PHP Scripting"),
enable_php
)
),
VSpacing(1), #translators: checkbox - support for perl script language
Expand Down
7 changes: 4 additions & 3 deletions src/modules/YaPI/HTTPDModules.pm
@@ -1,5 +1,6 @@
package YaPI::HTTPDModules;
use YaPI;
use YaST::HTTPDData;
textdomain "http-server";
%modules = (
# (without_leading mod_) module name = {
Expand Down Expand Up @@ -706,9 +707,9 @@ textdomain "http-server";
{ option =>"VirtualScriptAliasIP", "context" => [ "Server", "Virtual", "Directory" ] }
]
},
'php5' => {
summary => __("Provides support for PHP5 dynamically generated pages"),
packages => ["apache2-mod_php5"],
'php' . YaST::HTTPDData->PhpVersion() => {
summary => __("Provides support for PHP dynamically generated pages"),
packages => ["apache2-mod_php" . YaST::HTTPDData->PhpVersion()],
default => 0,
position => 490
},
Expand Down
6 changes: 6 additions & 0 deletions src/modules/YaST/HTTPDData.pm
Expand Up @@ -23,6 +23,12 @@ sub SetError {
return YaPI::HTTPD->SetError( @_ );
}

# Define globally the current PHP version
BEGIN { $TYPEINFO{PhpVersion} = ["function", "string" ]; }
sub PhpVersion {
return "7";
}

BEGIN { $TYPEINFO{Error} = ["function", [ "map", "string", "string" ] ]; }
sub Error {
return YaPI::HTTPD->Error();
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/getCurrentListen.rb
Expand Up @@ -10,8 +10,8 @@ def main
@READ = { "http_server" => { "listen" => ["80", "127.0.0.1:99"] } }
TESTSUITE_INIT([@READ, {}, {}], nil)

Yast.import "YaST::HTTPDData"
Yast.import "YaPI::HTTPD"
Yast.import "YaST::HTTPDData"


TEST(lambda { YaST::HTTPDData.ReadListen }, [@READ, {}, {}], nil)
Expand Down
1 change: 1 addition & 0 deletions testsuite/tests/parseDirOption.rb
Expand Up @@ -7,6 +7,7 @@ class ParseDirOptionClient < Client
def main
Yast.include self, "testsuite.rb"

Yast.import "YaPI::HTTPD"
Yast.import "YaST::HTTPDData"

TEST(lambda do
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/readHosts.rb
Expand Up @@ -190,8 +190,8 @@ def main

TESTSUITE_INIT([@READ, {}, {}], nil)

Yast.import "YaST::HTTPDData"
Yast.import "YaPI::HTTPD"
Yast.import "YaST::HTTPDData"


TEST(lambda { YaST::HTTPDData.ReadHosts }, [@READ, {}, {}], nil)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/readListen.rb
Expand Up @@ -10,8 +10,8 @@ def main
@READ = { "http_server" => { "listen" => ["80", "127.0.0.1:99"] } }
TESTSUITE_INIT([@READ, {}, {}], nil)

Yast.import "YaST::HTTPDData"
Yast.import "YaPI::HTTPD"
Yast.import "YaST::HTTPDData"

TEST(lambda { YaST::HTTPDData.ReadListen }, [@READ, {}, {}], nil)

Expand Down

0 comments on commit 05f412d

Please sign in to comment.