Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1246561
restore3.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
Fri, Nov 21, 11:25 AM
Size
3 KB
Mime Type
text/x-php
Expires
Sun, Nov 23, 11:25 AM (1 d, 8 h)
Engine
blob
Format
Raw Data
Handle
810232
Attached To
rINP In-Portal
restore3.php
View Options
<?php
// new startup: begin
define
(
'REL_PATH'
,
'admin/backup'
);
$relation_level
=
count
(
explode
(
'/'
,
REL_PATH
)
);
define
(
'FULL_PATH'
,
realpath
(
dirname
(
__FILE__
)
.
str_repeat
(
'/..'
,
$relation_level
)
)
);
require_once
FULL_PATH
.
'/kernel/startup.php'
;
// new startup: end
$pathtolocal
=
$pathtoroot
.
"kernel/"
;
require_once
(
$pathtoroot
.
"admin/include/elements.php"
);
require_once
(
$pathtoroot
.
"kernel/admin/include/navmenu.php"
);
require_once
(
$pathtolocal
.
"admin/include/navmenu.php"
);
require_once
(
$pathtoroot
.
"admin/toolbar.php"
);
require_once
(
$pathtoroot
.
$admin
.
"/install/install_lib.php"
);
$conn
=
&
GetADODBConnection
();
$section
=
"in-portal:restore"
;
int_header
(
NULL
);
//echo "FileOffset: $FileOffset <br>\n";
if
(
count
(
$_POST
))
{
$filename
=
"dump"
.
$_POST
[
"backupdate"
].
"txt"
;
$filename
=
$objConfig
->
Get
(
"Backup_Path"
).
"/"
.
$filename
;
}
else
$filename
=
$_GET
[
"Filename"
];
$FileOffset
=
(
int
)
$_GET
[
"Offset"
];
//echo "FileOffset: $FileOffset <br>\n";
if
(!
file_exists
(
$filename
))
{
echo
prompt_language
(
"la_restore_file_not_found"
).
" : $filename"
;
exit
();
}
if
(!
is_readable
(
$filename
))
{
echo
prompt_language
(
"la_restore_access_denied"
);
exit
();
}
$TotalSize
=
filesize
(
$filename
);
$MaxLines
=
200
;
$PageTitle
=
admin_language
(
"la_text_Restore_in_progress"
);
$CancelURL
=
$rootURL
.
"admin/backup/restore1.php?env="
.
BuildEnv
();
stats
(
$PageTitle
,
$FileOffset
,
$TotalSize
);
//echo "FileOffset: $FileOffset <br>\n";
if
(
$FileOffset
<
$TotalSize
)
{
$FileOffset
=
RunRestoreFile
(
$conn
,
$filename
,
$FileOffset
,
$MaxLines
);
if
(
$FileOffset
>-
1
)
{
if
(
$FileOffset
==
0
)
$FileOffset
=
$TotalSize
;
$url
=
$_SERVER
[
'PHP_SELF'
].
"?env="
.
BuildEnv
().
"&Offset=$FileOffset&Filename=$filename"
;
}
else
{
switch
(
$FileOffset
)
{
case
-
1
:
$error
=
prompt_language
(
"la_restore_file_error"
);
break
;
case
-
2
:
$error
=
prompt_language
(
"la_restore_read_error"
);
break
;
default
:
$error
=
"("
.
$FileOffset
.
") "
.
prompt_language
(
"la_restore_unknown_error"
);
break
;
}
echo
$error
;
die
();
}
}
else
$url
=
$adminURL
.
"/backup/restore4.php?env="
.
BuildEnv
();
reload
(
$url
);
echo
"</BODY>"
;
echo
"</HTML>"
;
function
stats
(
$caption
,
$myprogress
,
$totalnum
)
{
global
$rootURL
,
$CancelURL
;
if
(
$totalnum
>
0
)
{
$pct
=
round
((
$myprogress
/
$totalnum
)*
100
);
}
else
$pct
=
100
;
$o
.=
"<table width=
\"
100%
\"
border=
\"
0
\"
cellspacing=
\"
0
\"
cellpadding=
\"
4
\"
class=
\"
tableborder
\"
>"
;
echo
"
\n
"
;
$o
.=
int_subsection_title_ret
(
$caption
.
"-"
.
$pct
.
"%"
);
$o
.=
"<TR><TD align=
\"
middle
\"
><br />"
;
$o
.=
" <TABLE CLASS=
\"
tableborder_full
\"
width=
\"
75%
\"
>"
;
$o
.=
" <TR border=1><TD width=
\"
"
.
$pct
.
"%
\"
STYLE=
\"
background:url('"
.
$rootURL
.
"admin/images/progress_bar_segment.gif');
\"
> </TD>"
;
$comp_pct
=
100
-
$pct
;
$o
.=
" <TD bgcolor=#FFFFFF width=
\"
"
.
$comp_pct
.
"%
\"
></TD></TR>"
;
$o
.=
" </TABLE>"
;
$o
.=
" <BR /><input type=button VALUE=
\"
"
.
admin_language
(
"la_Cancel"
).
"
\"
CLASS=
\"
button
\"
ONCLICK=
\"
document.location='"
.
$CancelURL
.
"';
\"
>"
;
echo
$o
.
"
\n
"
;
echo
"</TD></TR></TABLE>"
;
}
function
reload
(
$url
)
{
print
"<script language=
\"
javascript
\"
>"
;
print
"setTimeout(
\"
document.location='$url';
\"
,40);"
;
print
" </script>"
;
echo
"<A HREF=
\"
$url
\"
>$url </A>"
;
}
?>
Event Timeline
Log In to Comment