Merge pull request #8053 from nextcloud/simplify-substr
Use short for of substr to not need strlen()
This commit is contained in:
commit
a7ad7cb08e
|
@ -167,7 +167,7 @@ class Storage {
|
||||||
// to get the right target
|
// to get the right target
|
||||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||||
if ($ext === 'part') {
|
if ($ext === 'part') {
|
||||||
$filename = substr($filename, 0, strlen($filename) - 5);
|
$filename = substr($filename, 0, -5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we only handle existing files
|
// we only handle existing files
|
||||||
|
|
|
@ -108,7 +108,7 @@ class Adapter {
|
||||||
$query .= ' = ? AND ';
|
$query .= ' = ? AND ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query = substr($query, 0, strlen($query) - 5);
|
$query = substr($query, 0, -5);
|
||||||
$query .= ' HAVING COUNT(*) = 0';
|
$query .= ' HAVING COUNT(*) = 0';
|
||||||
|
|
||||||
return $this->conn->executeUpdate($query, $inserts);
|
return $this->conn->executeUpdate($query, $inserts);
|
||||||
|
|
|
@ -79,7 +79,7 @@ class AdapterSqlite extends Adapter {
|
||||||
$query .= ' = ? AND ';
|
$query .= ' = ? AND ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query = substr($query, 0, strlen($query) - 5);
|
$query = substr($query, 0, -5);
|
||||||
$query .= ')';
|
$query .= ')';
|
||||||
|
|
||||||
return $this->conn->executeUpdate($query, $inserts);
|
return $this->conn->executeUpdate($query, $inserts);
|
||||||
|
|
|
@ -132,7 +132,7 @@ class OC_Template extends \OC\Template\Base {
|
||||||
foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) {
|
foreach(array_reverse($coreDependencies['vendor']) as $vendorLibrary) {
|
||||||
//remove trailing ".js" as addVendorScript will append it
|
//remove trailing ".js" as addVendorScript will append it
|
||||||
OC_Util::addVendorScript(
|
OC_Util::addVendorScript(
|
||||||
substr($vendorLibrary, 0, strlen($vendorLibrary) - 3),null,true);
|
substr($vendorLibrary, 0, -3),null,true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception('Cannot read core/js/core.json');
|
throw new \Exception('Cannot read core/js/core.json');
|
||||||
|
|
Loading…
Reference in New Issue