Skip to content

Commit

Permalink
Replace deprecated util.DateUtil class with util.Dates
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Oct 21, 2021
1 parent 68cf650 commit 68d158d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FTP protocol support for the XP Framework ChangeLog

## ?.?.? / ????-??-??

## 11.0.3 / 2021-10-21

* Replaced deprecated util.DateUtil class with `util.Dates` - @thekid

## 11.0.2 / 2021-10-21

* Made library compatible with `xp-framework/logging` version 11.0.0
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/peer/ftp/DefaultFtpListParser.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace peer\ftp;

use util\{Date, DateUtil};
use util\{Date, Dates};

/**
* Parses output from a FTP LIST command from Un*x FTP daemons.
Expand Down Expand Up @@ -56,7 +56,7 @@ public function entryFrom($raw, FtpConnection $conn= null, $base= '/', Date $ref
$ref || $ref= Date::now();
$d= new Date($month.' '.$day.' '.$ref->getYear().' '.$date);
if ($d->getTime() - $ref->getTime() > 15724800) {
$d= DateUtil::addMonths($d, -12);
$d= Dates::add($d, '-12 months');
}
} else {
$d= new Date($month.' '.$day.' '.$date);
Expand Down
6 changes: 3 additions & 3 deletions src/main/php/peer/ftp/server/FtpProtocol.class.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace peer\ftp\server;

use peer\{BSDSocket, SocketException};
use peer\ftp\server\storage\{Storage, StorageCollection, StorageElement};
use peer\server\ServerProtocol;
use peer\{BSDSocket, SocketException};
use security\auth\Authenticator;
use util\{Date, DateUtil};
use util\log\Traceable;
use util\{Date, Dates};

/**
* Implement FTP server functionality
Expand Down Expand Up @@ -444,7 +444,7 @@ public function onList($socket, $params) {
$elements= [$entry];
}

$before6Months= DateUtil::addMonths(Date::now(), -6)->getTime();
$before6Months= Dates::add(Date::now(), '-6 months')->getTime();
for ($i= 0, $s= sizeof($elements); $i < $s; $i++) {
$buf= sprintf(
'%s %2d %s %s %8d %s %s',
Expand Down

0 comments on commit 68d158d

Please sign in to comment.