Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yandex disk cleanup #340

Open
dnovikov32 opened this issue Jun 12, 2023 · 0 comments
Open

Yandex disk cleanup #340

dnovikov32 opened this issue Jun 12, 2023 · 0 comments

Comments

@dnovikov32
Copy link

Good day!
Cleanup does not work correctly when using synchronization on Yandex Disk.

In the arhitector/yandex library, which is used to work with Yandex.Disk, method Disk::getResource($path, $limit = 20, $offset = 0) has a default limit of 20. Because of this, an incomplete list of backups is returned.

The Yandex Disk client is used here, to get the full list, you can pass $limit = -1
$items = $this→disk→getResource($this→path→getPathThatIsNotChanging(), -1);

Example of my config:

"syncs": [
  {
    "type": "yandex-disk",
    "options": {
      "token": "adapter:environment:YANDEX_TOKEN",
      "path": "/backup/sitename/dump",
      "cleanup.type": "stepwise",
      "cleanup.daysToKeepDaily": 7,
      "cleanup.weeksToKeepWeekly": 4,
      "cleanup.monthToKeepMonthly": 12,
      "cleanup.yearsToKeepYearly": 3
    }
  }
]

My Yandex disk state (47 files):

mysql-20210224-0432.sql.bz2    1614130701     2021-02-24 01:38:21
mysql-20220101-0432.sql.bz2    1641001260     2022-01-01 01:41:00
mysql-20220528-0432.sql.bz2    1653701876     2022-05-28 01:37:56
mysql-20230404-0432.sql.bz2    1680572133     2023-04-04 01:35:33
mysql-20230501-0432.sql.bz2    1682905161     2023-05-01 01:39:21
mysql-20230502-0432.sql.bz2    1682991349     2023-05-02 01:35:49
mysql-20230503-0432.sql.bz2    1683077763     2023-05-03 01:36:03
mysql-20230504-0432.sql.bz2    1683164179     2023-05-04 01:36:19
mysql-20230505-0432.sql.bz2    1683250614     2023-05-05 01:36:54
mysql-20230506-0432.sql.bz2    1683337019     2023-05-06 01:36:59
mysql-20230507-0432.sql.bz2    1683423642     2023-05-07 01:40:42
mysql-20230508-0432.sql.bz2    1683509876     2023-05-08 01:37:56
mysql-20230509-0432.sql.bz2    1683596337     2023-05-09 01:38:57
mysql-20230510-0432.sql.bz2    1683682785     2023-05-10 01:39:45
mysql-20230511-0432.sql.bz2    1683768973     2023-05-11 01:36:13
mysql-20230512-0432.sql.bz2    1683855437     2023-05-12 01:37:17
mysql-20230513-0432.sql.bz2    1683941933     2023-05-13 01:38:53
mysql-20230514-0432.sql.bz2    1684028479     2023-05-14 01:41:19
mysql-20230515-0432.sql.bz2    1684114779     2023-05-15 01:39:39
mysql-20230516-0432.sql.bz2    1684200973     2023-05-16 01:36:13
mysql-20230517-0432.sql.bz2    1684287369     2023-05-17 01:36:09
mysql-20230518-0432.sql.bz2    1684373748     2023-05-18 01:35:48
mysql-20230519-0432.sql.bz2    1684460213     2023-05-19 01:36:53
mysql-20230520-0432.sql.bz2    1684546573     2023-05-20 01:36:13
mysql-20230521-0432.sql.bz2    1684633098     2023-05-21 01:38:18
mysql-20230522-0432.sql.bz2    1684719443     2023-05-22 01:37:23
mysql-20230523-0432.sql.bz2    1684805872     2023-05-23 01:37:52
mysql-20230524-0432.sql.bz2    1684892182     2023-05-24 01:36:22
mysql-20230525-0432.sql.bz2    1684978584     2023-05-25 01:36:24
mysql-20230526-0432.sql.bz2    1685064962     2023-05-26 01:36:02
mysql-20230527-0432.sql.bz2    1685151472     2023-05-27 01:37:52
mysql-20230528-0432.sql.bz2    1685238129     2023-05-28 01:42:09
mysql-20230529-0432.sql.bz2    1685324407     2023-05-29 01:40:07
mysql-20230530-0432.sql.bz2    1685410888     2023-05-30 01:41:28
mysql-20230531-0432.sql.bz2    1685496968     2023-05-31 01:36:08
mysql-20230601-0432.sql.bz2    1685583431     2023-06-01 01:37:11
mysql-20230602-0432.sql.bz2    1685669790     2023-06-02 01:36:30
mysql-20230603-0432.sql.bz2    1685756266     2023-06-03 01:37:46
mysql-20230603-1659.sql.bz2    1685800830     2023-06-03 14:00:30
mysql-20230604-0432.sql.bz2    1685842537     2023-06-04 01:35:37
mysql-20230605-0432.sql.bz2    1685928978     2023-06-05 01:36:18
mysql-20230606-0432.sql.bz2    1686015416     2023-06-06 01:36:56
mysql-20230607-0432.sql.bz2    1686101637     2023-06-07 01:33:57
mysql-20230608-0432.sql.bz2    1686188032     2023-06-08 01:33:52
mysql-20230609-0432.sql.bz2    1686274436     2023-06-09 01:33:56
mysql-20230610-0432.sql.bz2    1686360838     2023-06-10 01:33:58
mysql-20230611-0432.sql.bz2    1686447355     2023-06-11 01:35:55

List of files to delete (wrong result):

mysql-20230502-0432.sql.bz2
mysql-20230503-0432.sql.bz2
mysql-20230504-0432.sql.bz2
mysql-20230505-0432.sql.bz2
mysql-20230506-0432.sql.bz2
mysql-20230507-0432.sql.bz2
mysql-20230509-0432.sql.bz2
mysql-20230510-0432.sql.bz2
mysql-20230511-0432.sql.bz2
mysql-20230512-0432.sql.bz2
mysql-20230513-0432.sql.bz2
mysql-20230514-0432.sql.bz2
mysql-20230516-0432.sql.bz2

List of files to delete with limit -1 (correct result):

mysql-20230502-0432.sql.bz2
mysql-20230503-0432.sql.bz2
mysql-20230504-0432.sql.bz2
mysql-20230505-0432.sql.bz2
mysql-20230506-0432.sql.bz2
mysql-20230507-0432.sql.bz2
mysql-20230509-0432.sql.bz2
mysql-20230510-0432.sql.bz2
mysql-20230511-0432.sql.bz2
mysql-20230512-0432.sql.bz2
mysql-20230513-0432.sql.bz2
mysql-20230514-0432.sql.bz2
mysql-20230516-0432.sql.bz2
mysql-20230517-0432.sql.bz2
mysql-20230518-0432.sql.bz2
mysql-20230519-0432.sql.bz2
mysql-20230520-0432.sql.bz2
mysql-20230521-0432.sql.bz2
mysql-20230523-0432.sql.bz2
mysql-20230524-0432.sql.bz2
mysql-20230525-0432.sql.bz2
mysql-20230526-0432.sql.bz2
mysql-20230527-0432.sql.bz2
mysql-20230528-0432.sql.bz2
mysql-20230530-0432.sql.bz2
mysql-20230531-0432.sql.bz2
mysql-20230601-0432.sql.bz2
mysql-20230602-0432.sql.bz2
mysql-20230603-0432.sql.bz2
mysql-20230603-1659.sql.bz2
mysql-20230604-0432.sql.bz2

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant