mirror of
https://github.com/strapi/strapi.git
synced 2025-09-18 13:02:18 +00:00
Rename thisStrapi to strapi
This commit is contained in:
parent
355d056a4d
commit
1a54d70801
@ -294,7 +294,7 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const removeAssetsBackup = this.#removeAssetsBackup.bind(this);
|
const removeAssetsBackup = this.#removeAssetsBackup.bind(this);
|
||||||
const thisStrapi = this.strapi;
|
const strapi = this.strapi;
|
||||||
const transaction = this.transaction;
|
const transaction = this.transaction;
|
||||||
const backupDirectory = this.uploadsBackupDirectoryName;
|
const backupDirectory = this.uploadsBackupDirectoryName;
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
|||||||
// TODO: Remove this logic in V5
|
// TODO: Remove this logic in V5
|
||||||
if (!chunk.metadata) {
|
if (!chunk.metadata) {
|
||||||
// If metadata does not exist is because it is an old backup file
|
// If metadata does not exist is because it is an old backup file
|
||||||
const assetsDirectory = path.join(thisStrapi.dirs.static.public, 'uploads');
|
const assetsDirectory = path.join(strapi.dirs.static.public, 'uploads');
|
||||||
const entryPath = path.join(assetsDirectory, chunk.filename);
|
const entryPath = path.join(assetsDirectory, chunk.filename);
|
||||||
const writableStream = fse.createWriteStream(entryPath);
|
const writableStream = fse.createWriteStream(entryPath);
|
||||||
chunk.stream
|
chunk.stream
|
||||||
@ -350,10 +350,10 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
|||||||
buffer: chunk?.buffer,
|
buffer: chunk?.buffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const provider = thisStrapi.config.get('plugin.upload').provider;
|
const provider = strapi.config.get('plugin.upload').provider;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await thisStrapi.plugin('upload').provider.uploadStream(uploadData);
|
await strapi.plugin('upload').provider.uploadStream(uploadData);
|
||||||
|
|
||||||
// if we're not supposed to transfer the associated entities, stop here
|
// if we're not supposed to transfer the associated entities, stop here
|
||||||
if (!restoreMediaEntitiesContent) {
|
if (!restoreMediaEntitiesContent) {
|
||||||
@ -362,14 +362,14 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
|||||||
|
|
||||||
// Files formats are stored within the parent file entity
|
// Files formats are stored within the parent file entity
|
||||||
if (uploadData?.type) {
|
if (uploadData?.type) {
|
||||||
const entry: IFile = await thisStrapi.db.query('plugin::upload.file').findOne({
|
const entry: IFile = await strapi.db.query('plugin::upload.file').findOne({
|
||||||
where: { hash: uploadData.mainHash },
|
where: { hash: uploadData.mainHash },
|
||||||
});
|
});
|
||||||
const specificFormat = entry?.formats?.[uploadData.type];
|
const specificFormat = entry?.formats?.[uploadData.type];
|
||||||
if (specificFormat) {
|
if (specificFormat) {
|
||||||
specificFormat.url = uploadData.url;
|
specificFormat.url = uploadData.url;
|
||||||
}
|
}
|
||||||
await thisStrapi.db.query('plugin::upload.file').update({
|
await strapi.db.query('plugin::upload.file').update({
|
||||||
where: { hash: uploadData.mainHash },
|
where: { hash: uploadData.mainHash },
|
||||||
data: {
|
data: {
|
||||||
formats: entry.formats,
|
formats: entry.formats,
|
||||||
@ -378,11 +378,11 @@ class LocalStrapiDestinationProvider implements IDestinationProvider {
|
|||||||
});
|
});
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
const entry: IFile = await thisStrapi.db.query('plugin::upload.file').findOne({
|
const entry: IFile = await strapi.db.query('plugin::upload.file').findOne({
|
||||||
where: { hash: uploadData.hash },
|
where: { hash: uploadData.hash },
|
||||||
});
|
});
|
||||||
entry.url = uploadData.url;
|
entry.url = uploadData.url;
|
||||||
await thisStrapi.db.query('plugin::upload.file').update({
|
await strapi.db.query('plugin::upload.file').update({
|
||||||
where: { hash: uploadData.hash },
|
where: { hash: uploadData.hash },
|
||||||
data: {
|
data: {
|
||||||
url: entry.url,
|
url: entry.url,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user