files.new_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  
  """Handler for data backup operation.
  
  Generic datastore admin console transfers control to ConfirmBackupHandler
  after selection of entities. The ConfirmBackupHandler confirms with user
  his choice, enters a backup name and transfers control to
  DoBackupHandler. DoBackupHandler starts backup mappers and displays confirmation
  page.
  
  This module also contains actual mapper code for backing data over.
  """
  
  
  
  
  
  
  
  
  from __future__ import with_statement
  
  
  
  import copy
  import cStringIO
  import datetime
  import itertools
  import logging
  import os
  import random
  import re
  import time
  import urllib
  import xml.dom.minidom
  
  from google.appengine._internal import cloudstorage
  
  # AppScale: Use bundled mapreduce library.
  from google.appengine.ext.mapreduce import context
  from google.appengine.ext.mapreduce import datastore_range_iterators as db_iters
  from google.appengine.ext.mapreduce import input_readers
  from google.app
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/backup_handler.py
files.old_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  
  """Handler for data backup operation.
  
  Generic datastore admin console transfers control to ConfirmBackupHandler
  after selection of entities. The ConfirmBackupHandler confirms with user
  his choice, enters a backup name and transfers control to
  DoBackupHandler. DoBackupHandler starts backup mappers and displays confirmation
  page.
  
  This module also contains actual mapper code for backing data over.
  """
  
  
  
  
  
  
  
  
  from __future__ import with_statement
  
  
  
  import copy
  import cStringIO
  import datetime
  import itertools
  import json
  import logging
  import os
  import random
  import re
  import time
  import urllib
  import xml.dom.minidom
  
  from google.appengine._internal import cloudstorage
  
  # AppScale: Use bundled mapreduce library.
  from google.appengine.ext.mapreduce import context
  from google.appengine.ext.mapreduce import datastore_range_iterators as db_iters
  from google.appengine.ext.mapreduce import input_readers
  
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/backup_handler.py
files.new_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  """Main module for datastore admin receiver.
  
  To use, add this to app.yaml:
    builtins:
    - datastore_admin: on
  """
  
  
  
  import logging
  import operator
  import os
  
  from google.appengine.api import app_identity
  from google.appengine.api import datastore_errors
  from google.appengine.api import users
  from google.appengine.ext import deferred
  import webapp2 as webapp
  from google.appengine.ext.db import stats
  from google.appengine.ext.webapp import util
  from google.appengine.runtime import apiproxy_errors
  from google.appengine.ext.datastore_admin import backup_handler
  from google.appengine.ext.datastore_admin import config
  from google.appengine.ext.datastore_admin import delete_handler
  from google.appengine.ext.datastore_admin import utils
  
  
  
  
  
  
  ENTITY_ACTIONS = {
      'Delete Entities': delete_handler.ConfirmDeleteHandler.Render,
      'Back
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/main.py
files.old_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  """Main module for datastore admin receiver.
  
  To use, add this to app.yaml:
    builtins:
    - datastore_admin: on
  """
  
  
  
  import logging
  import operator
  import os
  
  from google.appengine.api import app_identity
  from google.appengine.api import datastore_errors
  from google.appengine.api import users
  from google.appengine.ext import deferred
  import webapp2 as webapp
  from google.appengine.ext.db import stats
  from google.appengine.ext.webapp import util
  from google.appengine.runtime import apiproxy_errors
  from google.appengine.ext.datastore_admin import backup_handler
  from google.appengine.ext.datastore_admin import config
  from google.appengine.ext.datastore_admin import delete_handler
  from google.appengine.ext.datastore_admin import utils
  
  
  
  
  
  
  ENTITY_ACTIONS = {
      'Delete Entities': delete_handler.ConfirmDeleteHandler.Render,
      'Back
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/main.py
files.new_contents: {% extends "base.html" %}
  {% block title %}Confirm Import of backup information{% endblock %}
  {% block body %}
    <h2>Datastore Admin: Import backup information</h2>
    {% if error %}
      <div class="ae-errorbox">{{ error|escape }}</div>
      <a href="{{ datastore_admin_home }}"><button>Back</button></a>
    {% else %}
      {% if not other_backup_info_files and not selected_backup_info_file %}
        <div class="ae-errorbox">No backup information files were found.</div>
        <a href="{{ datastore_admin_home }}"><button>Back</button></a>
      {% else %}
        <form action="{{base_path}}/{{form_target}}" method="post" style="width:39.39em;">
          <input type="hidden" name="xsrf_token" value="{{xsrf_token|escape}}">
          {% if not other_backup_info_files %}
            <b>Confirm import of:</b>
            <input type="hidden" name="gs_handle" value="{{selected_backup_info_file}}">{{selected_backup_info_file|escape}}
          {% else %}
            {% if selected_backup_info_file %}
              <b>Confirm import of:</b><br/>
              <input type="radio" name="gs_handle" value="{{selected_backup_info_file}}" checked>{{selected_backup_info_file|escape}}</br>
            {% else %}
              {% if backup_info_specified %}
                <b>Requested backup was not found, available backups:</b><br/>
             
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/templates/confirm_backup_import.html
files.old_contents: {% extends "base.html" %}
  {% block title %}Confirm Import of backup information{% endblock %}
  {% block body %}
    <h2>Datastore Admin: Import backup information</h2>
    {% if error %}
      <div class="ae-errorbox">{{ error|escape }}</div>
      <a href="{{ datastore_admin_home }}"><button>Back</button></a>
    {% else %}
      {% if not other_backup_info_files and not selected_backup_info_file %}
        <div class="ae-errorbox">No backup information files were found.</div>
        <a href="{{ datastore_admin_home }}"><button>Back</button></a>
      {% else %}
        <form action="{{base_path}}/{{form_target}}" method="post" style="width:39.39em;">
          <input type="hidden" name="xsrf_token" value="{{xsrf_token|escape}}">
          {% if not other_backup_info_files %}
            <b>Confirm import of:</b>
            <input type="hidden" name="gs_handle" value="{{selected_backup_info_file}}">{{selected_backup_info_file|escape}}
          {% else %}
            {% if selected_backup_info_file %}
              <b>Confirm import of:</b><br/>
              <input type="radio" name="gs_handle" value="{{selected_backup_info_file}}" checked>{{selected_backup_info_file|escape}}</br>
            {% else %}
              {% if backup_info_specified %}
                <b>Requested backup was not found, available backups:</b><br/>
             
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/templates/confirm_backup_import.html
files.new_contents: {% extends "base.html" %}
  {% block title %}Confirm Restore from a backup copy{% endblock %}
  {% block body %}
    <h2>Datastore Admin: Restore from a backup copy</h2>
    {% if backup %}
      Are you sure you want to restore from {{ backup.name }}?
      <br/>Restore does not delete any new entities added since the backup.
      However, it will replace existing entities with the backed-up version for the following kinds:
      <form action="{{base_path}}/{{form_target}}" method="post" style="width:39.39em;">
        {% if run_as_a_service %}
          <input type="hidden" name="run_as_a_service" value="{{ run_as_a_service|escape }}">
        {% endif %}
        <input type="hidden" name="backup_id" value="{{backup.key}}">
        <input type="hidden" name="xsrf_token" value="{{xsrf_token|escape}}">
        <input type="hidden" name="delete_backup_after_restore" value="{{ delete_backup_after_restore|escape }}">
        <ul>
          {% for kind in backup.kinds %}
            <li><input type="checkbox" name="kind" value="{{kind}}" checked="checked"/>{{ kind }}</li>
          {% endfor %}
        </ul>
        {% if notreadonly_warning %}
        <div>
          <h4 style="padding:0;margin-top:1em;margin-bottom:0.46em;">WARNING</h4>
          {% if original_app_warning %}
  
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/templates/confirm_restore_from_backup.html
files.old_contents: {% extends "base.html" %}
  {% block title %}Confirm Restore from a backup copy{% endblock %}
  {% block body %}
    <h2>Datastore Admin: Restore from a backup copy</h2>
    {% if backup %}
      Are you sure you want to restore from {{ backup.name }}?
      <br/>Restore does not delete any new entities added since the backup.
      However, it will replace existing entities with the backed-up version for the following kinds:
      <form action="{{base_path}}/{{form_target}}" method="post" style="width:39.39em;">
        {% if run_as_a_service %}
          <input type="hidden" name="run_as_a_service" value="{{ run_as_a_service|escape }}">
        {% endif %}
        <input type="hidden" name="backup_id" value="{{backup.key}}">
        <input type="hidden" name="xsrf_token" value="{{xsrf_token|escape}}">
        <input type="hidden" name="delete_backup_after_restore" value="{{ delete_backup_after_restore|escape }}">
        <ul>
          {% for kind in backup.kinds %}
            <li><input type="checkbox" name="kind" value="{{kind}}" checked="checked"/>{{ kind }}</li>
          {% endfor %}
        </ul>
        {% if notreadonly_warning %}
        <div>
          <h4 style="padding:0;margin-top:1em;margin-bottom:0.46em;">WARNING</h4>
          {% if original_app_warning %}
  
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/templates/confirm_restore_from_backup.html
files.new_contents: {% extends "base.html" %}
  {% block body %}
    <h2>Datastore Admin of {{hosting_app_id}}</h2>
    {% if run_as_a_service or offer_service %}
      <div class="ae-promo ae-rounded-sml">
        <strong>
          The managed backup service is deprecated, and will no longer be available as of
          Mar 27th, 2018.
        </strong>
      </div>
    {% endif %}
    {% if run_as_a_service %}
      <div class="ae-message ae-rounded-sml">
        Backup/Restore running as a service.
        <a href="{{datastore_admin_home}}?service=T">Disable</a>
      </div>
    {% else %}
      {% if offer_service %}
        <div class="ae-message ae-rounded-sml">
          This application may run backup/restore as a service.
          <a href="{{datastore_admin_home}}?run_as_a_service=True">Enable</a>
        </div>
      {% endif %}
    {% endif %}
    {% if error %}
    <div class="ae-errorbox">
      {{ error|escape }}
    </div>
    {% endif %}
    <div class="ae-table-caption">
      <div class="ae-paginate">
        <div class="g-section g-tpl-50-50 g-split">
          <div class="g-unit g-first">
            <strong>Entities</strong>
          </div>
          <div class="g-unit">
            <span id="ae-dash-quota-refresh
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/templates/list_actions.html
files.old_contents: {% extends "base.html" %}
  {% block body %}
    <h2>Datastore Admin of {{hosting_app_id}}</h2>
    {% if run_as_a_service or offer_service %}
      <div class="ae-promo ae-rounded-sml">
        <strong>
          The managed backup service is deprecated, and will no longer be available as of
          Mar 27th, 2018.
        </strong>
      </div>
    {% endif %}
    {% if run_as_a_service %}
      <div class="ae-message ae-rounded-sml">
        Backup/Restore running as a service.
        <a href="{{datastore_admin_home}}?service=T">Disable</a>
      </div>
    {% else %}
      {% if offer_service %}
        <div class="ae-message ae-rounded-sml">
          This application may run backup/restore as a service.
          <a href="{{datastore_admin_home}}?run_as_a_service=True">Enable</a>
        </div>
      {% endif %}
    {% endif %}
    {% if error %}
    <div class="ae-errorbox">
      {{ error|escape }}
    </div>
    {% endif %}
    <div class="ae-table-caption">
      <div class="ae-paginate">
        <div class="g-section g-tpl-50-50 g-split">
          <div class="g-unit g-first">
            <strong>Entities</strong>
          </div>
          <div class="g-unit">
            <span id="ae-dash-quota-refresh
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/templates/list_actions.html
files.new_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  """Used render templates for datastore admin."""
  
  
  
  import base64
  import datetime
  import json
  import logging
  import os
  import random
  import time
  
  # AppScale: Use bundled mapreduce library.
  from google.appengine.ext.mapreduce import context
  from google.appengine.ext.mapreduce import control
  from google.appengine.ext.mapreduce import model
  from google.appengine.ext.mapreduce import operation as mr_operation
  from google.appengine.ext.mapreduce import util
  
  from google.appengine.api import app_identity
  from google.appengine.api import datastore
  from google.appengine.api import datastore_errors
  from google.appengine.api import memcache
  from google.appengine.api import urlfetch
  from google.appengine.api import users
  from google.appengine.datastore import datastore_rpc
  from google.appengine.datastore import entity_pb
  from google.appengine.ext import db
  import webapp2 as
  
  [... the rest is omitted ...]
files.new_path: AppServer/google/appengine/ext/datastore_admin/utils.py
files.old_contents: #!/usr/bin/env python
  #
  # Copyright 2007 Google Inc.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  
  
  
  """Used render templates for datastore admin."""
  
  
  
  import base64
  import datetime
  import logging
  import os
  import random
  import time
  
  # AppScale: Use bundled mapreduce library.
  from google.appengine.ext.mapreduce import context
  from google.appengine.ext.mapreduce import control
  from google.appengine.ext.mapreduce import model
  from google.appengine.ext.mapreduce import operation as mr_operation
  from google.appengine.ext.mapreduce import util
  
  from google.appengine.api import datastore
  from google.appengine.api import datastore_errors
  from google.appengine.api import memcache
  from google.appengine.api import users
  from google.appengine.datastore import datastore_rpc
  from google.appengine.datastore import entity_pb
  from google.appengine.ext import db
  import webapp2 as webapp
  from google.appengine.ext.datastore_admin import config
  from google.appengine.ext.db import
  
  [... the rest is omitted ...]
files.old_path: AppServer/google/appengine/ext/datastore_admin/utils.py