Dodanie funkcji czyszczenia cache oraz przycisku do ponownego wysyłania zamówienia do apilo.com; poprawa sortowania transportów w bazie danych

This commit is contained in:
2024-12-20 21:30:18 +01:00
parent d993d53002
commit 84c9e285d6
9 changed files with 187 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ class Update
foreach ( $versions as $ver )
{
$ver = trim( $ver );
if ( (float)$ver > (float)\S::get_version() )
if ( floatval( $ver ) > (float)\S::get_version() )
{
if ( strlen( $ver ) == 5 )
$dir = substr( $ver, 0, strlen( $ver ) - 2 ) . 0;
@@ -34,29 +34,47 @@ class Update
else
{
/* aktualizacja bazy danych */
$sql = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt' );
$sql = explode( PHP_EOL, $sql );
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HEADER, true );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );
if ( $response and strpos( $content_type, 'text/plain' ) !== false )
$sql = explode( PHP_EOL, $response );
if ( is_array( $sql ) and !empty( $sql ) ) foreach ( $sql as $query )
{
if ( $sql )
{
$result = $mdb -> query( $query );
}
}
/* usuwanie zbędnych plików */
$lines = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt' );
$lines = explode( PHP_EOL, $lines );
if ( is_array( $lines ) ) foreach ( $lines as $line )
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HEADER, true );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );
if ( $response and strpos( $content_type, 'text/plain' ) !== false )
$files = explode( PHP_EOL, $response );
if ( is_array( $files ) and !empty( $files ) ) foreach ( $files as $file )
{
if ( strpos( $line, 'F: ' ) !== false )
if ( strpos( $file, 'F: ' ) !== false )
{
$file = substr( $line, 3, strlen( $line ) );
$file = substr( $file, 3, strlen( $file ) );
if ( file_exists( $file ) )
unlink( $file );
}
if ( strpos( $line, 'D: ' ) !== false )
if ( strpos( $file, 'D: ' ) !== false )
{
$dir = substr( $line, 3, strlen( $line ) );
$dir = substr( $file, 3, strlen( $file ) );
if ( is_dir( $dir ) )
\S::delete_dir( $dir );
}