PluginProbe
Disk Usage Insights / 1.2
Disk Usage Insights v1.2
trunk 1.0 1.10 1.11 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9
← All changes | src/Domain/FileEntryRepository.php +0 -36 1.81.2 View file →
@@ -81,44 +81,8 @@
81 81
82 82 return $entry;
83 83 }
84 84
85 - /**
86 - *
87 - * @param string $relativeFilename e.g. '/wp-content/plugins'
88 - * @throws \Exception
89 - * @return FileEntry|null
90 - */
91 - public function findByRelativeName(string $relativeFilename): ?FileEntry {
92 -
93 - $arr = explode('/', $relativeFilename);
94 - $parentId = 0; // root entry
95 - $result = null;
96 - foreach ($arr as $part) {
97 - $stmt = $this->db->prepare("
98 - SELECT * FROM fileentries WHERE parent_id = :parent_id AND name = :name;
99 - ");
100 - $stmt->bindValue(':parent_id', $parentId);
101 - $stmt->bindValue(':name', $part);
102 - $stmt->execute();
103 - $result = $stmt->fetch(\PDO::FETCH_ASSOC);
104 - if ($result === false) {
105 - throw new \Exception(sprintf("Error finding %s", esc_html($relativeFilename)));
106 - }
107 - $parentId = $result['id'];
108 - }
109 -
110 - if ($result !== null) {
111 - $entry = new FileEntry();
112 - foreach ($result as $key => $value) {
113 - $entry->$key = $value;
114 - }
115 - return $entry;
116 - } else {
117 - return null;
118 - }
119 - }
120 -
121 85 private static $cache = [];
122 86 public function calcFullPath(FileEntry $fileEntry, string $root = ''): string {
123 87 $full = $fileEntry->name;
124 88 while ($fileEntry->parent_id != 0) {