Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1949443
prerequisit.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Oct 29, 6:13 AM
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Oct 31, 6:13 AM (2 h, 12 m)
Engine
blob
Format
Raw Data
Handle
962362
Attached To
rMINC Modules.In-Commerce
prerequisit.php
View Options
<?php
$PreRequisitErrors
=
Array
();
$path
=
$pathtoroot
.
'in-commerce'
;
$result
=
true
;
if
(!
is_writable
(
FULL_PATH
.
'/kernel/downloads'
))
{
$result
=
false
;
$PreRequisitErrors
[]
=
'In-commerce
\'
s Downloads directory must be writable ('
.
$pathtoroot
.
'kernel'
.
$pathchar
.
'downloads)'
;
}
if
(!
function_exists
(
'ConvertVersion'
))
{
function
ConvertVersion
(
$version
)
{
$parts
=
explode
(
'.'
,
$version
);
$bin
=
''
;
foreach
(
$parts
as
$part
)
{
$bin
.=
str_pad
(
decbin
(
$part
),
8
,
'0'
,
STR_PAD_LEFT
);
}
$dec
=
bindec
(
$bin
);
return
$dec
;
}
}
$min_versions
=
Array
(
'In-Portal'
=>
'1.1.0'
,
'In-Link'
=>
'3.1.0'
,
'In-News'
=>
'1.1.0'
,
'In-Bulletin'
=>
'1.1.0'
);
$conn
=&
GetADODBConnection
();
$query
=
'SELECT * FROM '
.
GetTablePrefix
().
'Modules'
;
$rs
=
$conn
->
Execute
(
$query
);
while
(
$rs
&&
!
$rs
->
EOF
)
{
if
(
isset
(
$min_versions
[
$rs
->
fields
[
'Name'
]]))
{
if
(
ConvertVersion
(
$rs
->
fields
[
'Version'
])
<
ConvertVersion
(
$min_versions
[
$rs
->
fields
[
'Name'
]])
)
{
$PreRequisitErrors
[]
=
'Please upgrade '
.
$rs
->
fields
[
'Name'
].
' to version '
.
$min_versions
[
$rs
->
fields
[
'Name'
]].
' or above'
;
$result
=
false
;
}
}
$rs
->
MoveNext
();
}
if
(
isset
(
$show_errors
)
&&
$show_errors
)
{
foreach
(
$PreRequisitErrors
as
$error
)
{
echo
'<b><font color="#FF0000">'
.
$error
.
'</font></b><br />'
;
}
}
?>
Event Timeline
Log In to Comment